fnGetData - not working on dynamic data
fnGetData - not working on dynamic data
rajzamitesh
Posts: 4Questions: 0Answers: 0
the following code ( from http://datatables.net/api# )
[code]
// Individual cell data
$(document).ready(function() {
oTable = $('#example').dataTable();
oTable.$('td').click( function () {
var sData = oTable.fnGetData( this );
alert( 'The cell clicked on had the value of '+sData );
} );
} );
[/code]
shows the value of the row when clicking on it.
If the table is static (not fetched from server), it works fine.
But if the data is fetched from server, then it works only on the data that is shown on the first page.
If the number of records to show is changed, it does not work.
[code]
// Individual cell data
$(document).ready(function() {
oTable = $('#example').dataTable();
oTable.$('td').click( function () {
var sData = oTable.fnGetData( this );
alert( 'The cell clicked on had the value of '+sData );
} );
} );
[/code]
shows the value of the row when clicking on it.
If the table is static (not fetched from server), it works fine.
But if the data is fetched from server, then it works only on the data that is shown on the first page.
If the number of records to show is changed, it does not work.
This discussion has been closed.
Replies
See the top FAQ :-)
http://datatables.net/faqs#events
Allan