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:

orders_table.cell("#order-cell-46412~Quantity").data(16);

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

Answers

  • 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:
    http://live.datatables.net/yogosusa/1/edit

  • allanallan Posts: 62,992Questions: 1Answers: 10,367 Site admin

    Hi,

    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.

    Regards,
    Allan

This discussion has been closed.