Access Dynamically Added Row

Access Dynamically Added Row

MattSkeldonMattSkeldon Posts: 19Questions: 1Answers: 0
edited August 2013 in General
Good Morning All

I was rather hoping to be able to dynamically add a row to a datatable and then access the row that was added to do "stuff" to it using other jquery calls, what I had in mind was the following.

[code]
var r = oTable.fnAddData(["", "New User", "New Date"]);
r.data("id", varID);
[/code]

However this does not do anything.

Is there a way to access the row that was added using the fnAddData() function?

Replies

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    fnAddData returns an array of indexes - those indexes are the added rows. So you would do something like:

    [code]
    var r = oTable.fnAddData( ... );
    var n = oTable.fnGetNodes( r[0] );
    var d = oTable.fnGetData( r[0] );
    [/code]

    The new API in v1.10 should be a bit more intuitive (when I've documented it...)

    etc
  • MattSkeldonMattSkeldon Posts: 19Questions: 1Answers: 0
    Very much appreciated. Thanks Allan.
    Bang on the money as usual my friend.
This discussion has been closed.