fnUpdate question

fnUpdate question

EranEran Posts: 26Questions: 0Answers: 0
edited January 2013 in DataTables 1.9
Hi,

Assuming I have a table and it has a primay key,
I pass the data to the table via aaData and specify the columns via aoColumns.

How do I pass fnUpdate the row I want to update by using the key and not aoColumns ?

For example:

aoData index ********* Table UI index (Primary key)
0 ******************** 3
1 ******************** 6
2 ******************** 7
3 ******************* 8
4 ******************* 9


If I want to update the third row, I'd like to pass '7' and not '2' as the second argument.
Can I do that somehow ?

Replies

  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin
    Currently it is a little tricky (I'm planning to resolve that as part of the new API in 1.10), but basically you need to get a reference to the row you are targeting. The easiest way of doing this is to use the `DT_RowId` property with your primary key (which is how Editor operates) - then you can query the DOM for your primary key - `$('#row-12')` for example and pass the _node_ (i.e. `$('#row-12')[0]` ) into fnUpdate . Again this is something that will be improved in the new API...!

    Allan
  • EranEran Posts: 26Questions: 0Answers: 0
    Hi,

    I've already ran into the DT_RowId solution after searching the forums.
    Haven't tried it, but I was hoping there might be a more elegant solution....

    Now I'm struggling with the decision I have to make - whether to wait for version 1.10 or to implement some temporarly workarounds...

    Can you please estimate when version 1.10 will be released ?
    I know it's supposed to be released on Feburary, but can you be more specific regarding the date ?

    I desperately need that update :)
This discussion has been closed.