Show and hide details about a particular record
Show and hide details about a particular record
Hi Allan,
I changed a bit on your code "Show and hide details about a particular record " example at Server-side processing categories.
When open detail of a record It wil close last open detail.
This is code:
[code]
function fnOpenClose ( oSettings ) {
$('td img', oTable.fnGetNodes() ).each( function () {
$(this).click( function () {
var nTr = this.parentNode.parentNode;
var iIndex = oTable.fnGetPosition( nTr );
var aData = oTable.fnSettings().aoData[iIndex]._aData;
if ( this.src.match('details_close'))
{
this.src = "../examples_support/details_open.png";
var nRemove = $(nTr).next()[0];
nRemove.parentNode.removeChild( nRemove );
}
else
{
if (source!="")
{
source.src = "../examples_support/details_open.png";
remove.parentNode.removeChild( remove );
source="";
remove="";
}
/* Open this row */
this.src = "../examples_support/details_close.png";
source=this;
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
remove=$(nTr).next()[0];
}
});
});
}
[/code]
I changed a bit on your code "Show and hide details about a particular record " example at Server-side processing categories.
When open detail of a record It wil close last open detail.
This is code:
[code]
function fnOpenClose ( oSettings ) {
$('td img', oTable.fnGetNodes() ).each( function () {
$(this).click( function () {
var nTr = this.parentNode.parentNode;
var iIndex = oTable.fnGetPosition( nTr );
var aData = oTable.fnSettings().aoData[iIndex]._aData;
if ( this.src.match('details_close'))
{
this.src = "../examples_support/details_open.png";
var nRemove = $(nTr).next()[0];
nRemove.parentNode.removeChild( nRemove );
}
else
{
if (source!="")
{
source.src = "../examples_support/details_open.png";
remove.parentNode.removeChild( remove );
source="";
remove="";
}
/* Open this row */
this.src = "../examples_support/details_close.png";
source=this;
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
remove=$(nTr).next()[0];
}
});
});
}
[/code]
This discussion has been closed.
Replies
Awesome - thanks very much for that :-). Also for your other recent posts as well! I'm sure others will find them of use.
Regards,
Allan