row selection does not work when table loaded via ajax
row selection does not work when table loaded via ajax
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
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
This discussion has been closed.
Replies
Allan