row selection does not work when table loaded via ajax

row selection does not work when table loaded via ajax

JerryKurJerryKur Posts: 5Questions: 0Answers: 0
edited October 2012 in General
Hi,

I got row selection working in my datatable when I load the data statically in the html file. Ex:




Test
TestID
Release Day
Release




sample test 1
1
Mon


...


But, when I convert the rows of the table to come from data retrieved from a web service (via $.ajax call), the data displays, but the row selection no longer works.

To detect the row selection I tried two methods. First, I used click handler of the form:
$("#tblTest tbody tr").click(function (e) { ..... }

The other selection was done by setting oTableTools objects in the form:
"oTableTools" : {
"sRowSelect" : "single",
"fnRowSelected" : function(node) { alert('Row ' + node.id + ' selected.'); }

Both of these work for the static table and fail for the dynamic table.

Does anyone have an idea of what I am doing wrong?

Thanks,

Jerry

Replies

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    See the top FAQ: http://datatables.net/faqs#events

    Allan
This discussion has been closed.