Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81687

row selection does not work when table loaded via ajax

$
0
0
Hi,

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

<table id="tblTest" class="display">
<thead>
<tr>
<th>Test</th>
<th>TestID</th>
<th>Release Day</th>
<th>Release</th>
</tr>
</thead>
<tbody>
<tr>
<td>sample test 1</td>
<td>1</td>
<td>Mon</td>
<td class="center"><input type="checkbox" name="check1" value="1"></td>
</tr>
...


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

Viewing all articles
Browse latest Browse all 81687

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>