Delete Row that is not visible (because it's on a different page)

Delete Row that is not visible (because it's on a different page)

crickeyscrickeys Posts: 2Questions: 0Answers: 0
edited November 2010 in General
I have a dynamic table in which events occur that require rows that may not be visible to be deleted. Let's say I have a certain row with an ID=5, (e.g. ...) and it happens to be on another page.

Well, it doesn't exist yet in the DOM, so how on earth would I remove it from the table? I tried to store the positions of any dynamically added rows in a hashmap, but whenever I delete a row it ruins all the original positions, so I can't use fnDeleteRow(pos);

Any ideas??

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    What you could do is make use of fnGetNodes ( http://datatables.net/api#fnGetNodes ), something like this:

    [code]
    oTable.fnDeleteRow( $('#whatever_id', oTable.fnGetNodes())[0] );
    [/code]
    fnGetNodes will just return an array of all TR elements in the table (including hidden ones) which you can pass to jQuery and do the selector thing on it. And that should do the trick :-)

    Regards,
    Allan
This discussion has been closed.