jquery data table row details and fnReloadAjax()
jquery data table row details and fnReloadAjax()
Jquery data table has supporting expand row details about particular record.It is working for default loading.Once used nReloadAjax to reload a grid.Then try to expand a row. Row not expanding for details. advice me.
[code]$(document).ready(function() {
oTable = $('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "scripts/details_col.php",
"aoColumns": [
{ "sClass": "center", "bSortable": false },
null,
null,
null,
{ "sClass": "center" },
{ "sClass": "center" },
{ "sClass": "center" },
{ "sClass": "center" },
{ "sClass": "center" }
],
"aaSorting": [[1, 'asc']]
} );
$('#example tbody td').live( 'click', function () {
var nTr = $(this).parents('tr')[0];
if ( oTable.fnIsOpen(nTr) )
{
/* This row is already open - close it */
this.src = "../examples_support/details_open.png";
oTable.fnClose( nTr );
}
else
{
/* Open this row */
this.src = "../examples_support/details_close.png";
console.log("load");
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
} );
function reload() {
oTable.fnReloadAjax();
}
[/code]
[code]$(document).ready(function() {
oTable = $('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "scripts/details_col.php",
"aoColumns": [
{ "sClass": "center", "bSortable": false },
null,
null,
null,
{ "sClass": "center" },
{ "sClass": "center" },
{ "sClass": "center" },
{ "sClass": "center" },
{ "sClass": "center" }
],
"aaSorting": [[1, 'asc']]
} );
$('#example tbody td').live( 'click', function () {
var nTr = $(this).parents('tr')[0];
if ( oTable.fnIsOpen(nTr) )
{
/* This row is already open - close it */
this.src = "../examples_support/details_open.png";
oTable.fnClose( nTr );
}
else
{
/* Open this row */
this.src = "../examples_support/details_close.png";
console.log("load");
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
} );
function reload() {
oTable.fnReloadAjax();
}
[/code]
This discussion has been closed.
Replies
Have you referenced the reloading via ajax plugin correctly. Having said that since you are using server side processing, even if you use the fnReloadAjax plugin, it just redraws the table. Instead you can just use
[code]
oTable.fnDraw(true); // Need not specify 'true' as this is 'default'
[/code]