Change with jQuery a cell of a table created with JSF

Posted by perissf on Stack Overflow See other posts from Stack Overflow or by perissf
Published on 2012-06-08T21:12:23Z Indexed on 2012/06/08 22:40 UTC
Read the original article Hit count: 284

Filed under:
|
|
|

From within a xhtml page created with JSF, I need to use JavaScript / jQuery for changing the content of a cell of a table. I know how to assign a unique id to the div containing the table, and to the tbody. I can also assign unique class names to the div itself and to the target column. The target row is identified by the data-rk attribute.

<div id="tabForm:centerTabView:personsTable" class="ui-datatable ui-widget personsTable">
    <table role="grid">
        <tbody id="tabForm:centerTabView:personsTable_data" >
            <tr data-rk="2" >
                <td ... />
                <td class="lastNameCol" role="gridcell">
                    <div> To Be Edited </div>
                </td>
                <td ... />
            </tr>
            <tr ... />
        </tbody>
    </table>
</div>

I have tried with many combinations of different jQuery selectors, but I am really lost. I need to search my target row and my target column inside that particular div or inside that particular table, because the xhtml page may contain other tables with different unique ids (and accidentally with the same row and column ids).

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery