Unable to update cell by id

Unable to update cell by id

brianaricebrianarice Posts: 3Questions: 1Answers: 0

in my columns definition for Quantity I have:

fnCreatedCell: function (nTd, sData, oData, iRow, iCol) { nTd.id = "order-cell-" + oData["OrderId"] + "~" + "Quantity"; }

resulting in the following when I inspect the html in firefox:

<td id="order-cell-46412~Quantity">15</td>

However when I call:


I get the error: "Error: cell[0] is undefined"

and when I stringify orders_table.cell("#order-cell-46412~Quantity") I get:

order-cell-46412~Quantity = {"0":[],"context":[{"oFeatures":{"bAutoWidth":true,"bDeferRende...

I'm guessing the problem is "0":[] is an empty array... but why?

  • Brian

upload debug information: ibatus


  • brianaricebrianarice Posts: 3Questions: 1Answers: 0

    Note: all rows were added dynamically with order_table.rows.add()

  • brianaricebrianarice Posts: 3Questions: 1Answers: 0

    Also... I tried to create a demo of this issue... but I am getting "no data" in the table... if anyone can help me with that it's appreciated:

  • allanallan Posts: 48,883Questions: 1Answers: 7,122 Site admin


    Its the tilde that's causing the issue - changing it to a dash fixes the problem (I've also added a call to draw() to make to show the newly added data): http://live.datatables.net/yogosusa/3/edit

    A tilde is actually valid as an ID in HTML5, but DataTables using jQuery to perform selections (for backwards compatibility) and in jQuery, as with CSS, the tilde is the selector for next siblings.


Sign In or Register to comment.