[Help] Select a row after fnAddData
[Help] Select a row after fnAddData
Dear All,
I have another problem about insert and select a row.
I insert table dynamic use fnAddData.
Insert function is find.
But after insert, I want select a row, and I use fnGetData.
Then I can't select a row I insert before.
Javascript as following.
[code]
$('#example tbody tr').click( function () {
var aData = $('#example').dataTable().fnGetData( this );
alert(aData[0]);
alert(aDate[1]);
});
[/code]
HTML as following.
[code]
Head_1
Head_2
1
2
[/code]
I just can't select row use fnGetData.
if I write a table use HTML, I can select any row I want.
Any one can help?
Best Regards,
Shihyi Chiu
I have another problem about insert and select a row.
I insert table dynamic use fnAddData.
Insert function is find.
But after insert, I want select a row, and I use fnGetData.
Then I can't select a row I insert before.
Javascript as following.
[code]
$('#example tbody tr').click( function () {
var aData = $('#example').dataTable().fnGetData( this );
alert(aData[0]);
alert(aDate[1]);
});
[/code]
HTML as following.
[code]
Head_1
Head_2
1
2
[/code]
I just can't select row use fnGetData.
if I write a table use HTML, I can select any row I want.
Any one can help?
Best Regards,
Shihyi Chiu
This discussion has been closed.
Replies
- jquery.dataTables.js (1.9.0)
- jquery-1.7.2.min.js
Any solution?
Many Thanks!
João Santos
/* Add a click handler to the rows - this could be used as a callback */
$("#example tbody").click(function(event) {
$(oTable.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
});
(extracted from http://datatables.net/examples/api/select_single_row.html)