row details and fnReloadAjax()
row details and fnReloadAjax()
I've got a bit of a mental block about this.
I've got a table which uses hidden detail rows as detailed in http://www.datatables.net/release-datatables/examples/api/row_details.html
I also have it auto-refreshing via fnReloadAjax().
The problem is that the Ajax refresh closes any open detail rows and I'd like them to remain open. Ideally I would like this to appear seamless, rather than having them disappear and then reopen, but I'll take what I can get :-)
I have modified the details row code to store rows with open details in an array
[code]
$('#aaclb tbody td img.showchild').live('click', function () {
var nTr = this.parentNode.parentNode;
if (this.src.match('details_close')) {
/* This row is already open - close it */
this.src = "details_open.png";
/* Remove from open rows array */
var idx = scoringData.openRows.indexOf(nTr)
if (idx != -1) scoringData.openRows.splice(idx, 1);
oTable.fnClose(nTr);
}
else {
/* Open this row */
this.src = "details_close.png";
/* Store in open rows array so AJAX knows to leave it open */
scoringData.openRows.push(nTr);
oTable.fnOpen(nTr, fnFormatDetails(oTable, nTr), 'details');
}
});
[/code]
Can anyone help me out?
I've got a table which uses hidden detail rows as detailed in http://www.datatables.net/release-datatables/examples/api/row_details.html
I also have it auto-refreshing via fnReloadAjax().
The problem is that the Ajax refresh closes any open detail rows and I'd like them to remain open. Ideally I would like this to appear seamless, rather than having them disappear and then reopen, but I'll take what I can get :-)
I have modified the details row code to store rows with open details in an array
[code]
$('#aaclb tbody td img.showchild').live('click', function () {
var nTr = this.parentNode.parentNode;
if (this.src.match('details_close')) {
/* This row is already open - close it */
this.src = "details_open.png";
/* Remove from open rows array */
var idx = scoringData.openRows.indexOf(nTr)
if (idx != -1) scoringData.openRows.splice(idx, 1);
oTable.fnClose(nTr);
}
else {
/* Open this row */
this.src = "details_close.png";
/* Store in open rows array so AJAX knows to leave it open */
scoringData.openRows.push(nTr);
oTable.fnOpen(nTr, fnFormatDetails(oTable, nTr), 'details');
}
});
[/code]
Can anyone help me out?
This discussion has been closed.