oSettings object?
oSettings object?
Maybe I'm just missing it - but I can't for the life of me locate any documentation as to what the oSettings object is.
I have a table in which I'm adding a new row to it. Now, I need that specific row object I just added. Apparently fnAddData() only returns the row index that was added (why not the row objects?). The documentations said I can use oSettings to get the row object. ... but I can't find out how to do that. There's no docs on oSettings object (that I could find).
How? Did I miss the api docs on this object?
Thnx
I have a table in which I'm adding a new row to it. Now, I need that specific row object I just added. Apparently fnAddData() only returns the row index that was added (why not the row objects?). The documentations said I can use oSettings to get the row object. ... but I can't find out how to do that. There's no docs on oSettings object (that I could find).
How? Did I miss the api docs on this object?
Thnx
This discussion has been closed.
Replies
Here is a little code which will do what you are looking for:
[code]
var ai = oTable.fnAddData();
var data = oTable.fnSettings().aoData;
var row = data[ ai[0] ].nTr;
[/code]
I suppose this should be abstracted into an API function... :-)
The reason for returning the index is mainly historical now. If I were to do it again, then it would return the node as that is more likely to be useful than the aoData index (although it can be useful at times), but that won't change until DataTables 2.0 takes shape (whenever that might be). A lot of the interaction was with aoData array before - but I've tried to reduce that a bit recently (fnDeleteRow for example).
Allan