Show and hide details about a particular record

Show and hide details about a particular record

iuliandumiuliandum Posts: 70Questions: 0Answers: 0
edited May 2010 in General
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]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi iuliandum,

    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
This discussion has been closed.