Using fnGetPosition on dynamic tables

Using fnGetPosition on dynamic tables

andrew.bishopandrew.bishop Posts: 6Questions: 0Answers: 0
edited April 2009 in General
Hi again. I was wondering about getting the position of a selected row in tables that are dynamically created with AJAX. The example shown for fnGetPosition would work for me if I had td's or tr's in the table body, but since Datatables is drawing the table from a datasource, there are none.

I'm hoping to create a hyperlink for the row. When a user clicks anywhere on a particular row, it will send them to another page (in my case, a "details" page)

Thanks for you help!
Andrew

Replies

  • allanallan Posts: 63,205Questions: 1Answers: 10,415 Site admin
    Hi Andrew,

    If I understand correctly, then you can certainly do what you are looking for - the key is added event handlers post initialisation: http://datatables.net/examples/example_events_post_init.html .

    You can get all of the TRs (and subsequently the TDs) by using fnGetNodes(). From there fnGetPosition() should work perfectly.

    Allan
This discussion has been closed.