oSettings object?

oSettings object?

guiceguice Posts: 5Questions: 0Answers: 0
edited February 2010 in General
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

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    It's not documented - it's really an internal information object. It's well documented in the code if you look there - but in theory you shouldn't need to access it, rather using the API functions. Of course if you are creating an API function, or doing something that isn't abstracted out - then you will need to look at it :-)

    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
This discussion has been closed.