Update row/cell not currently visible

Update row/cell not currently visible

dloewendloewen Posts: 3Questions: 1Answers: 0
edited July 2014 in Free community support

Hi, I'm trying to update a cell in a DataTable that's on a different "page", using version 1.10. Since it's not visible to the DOM I can't manipulate it with jQuery selectors.

The table is initialized on existing HTML markup, where the rows look like this:

<tr data-id="1">
    <td><label><input type="checkbox" name="part[]" value="1"></label></td>
    <td>(Description)</td>
    <td>(Price)</td>
    <td>(Quantity)</td>
</tr>

More specifically, I'd like to un-check the checkbox, targeting the table row by the data-id attribute I added.

From reading documentation it looks like the .data() api can help with this, but how do I select by my data-id attribute and then change the HTML of that first table cell?

Thanks for your time.

Answers

  • DaimianDaimian Posts: 62Questions: 1Answers: 15

    A solution would be to add a hidden column that would hold the data-id for you. You would then be able to find that row without needing it rendered.

  • dloewendloewen Posts: 3Questions: 1Answers: 0

    Thanks for the response, Daimian. I don't think I follow, how would I be able to find and manipulate a row's cell contents using a hidden column?

  • dloewendloewen Posts: 3Questions: 1Answers: 0
    edited July 2014

    Thanks kasey, but that appears to be for the previous version of DataTables.

    I ended up resolving this issue by queueing the IDs not present on the current page in an array for later, then checking for them each time the draw event was fired.

This discussion has been closed.