Not a listener on all detailrows
Not a listener on all detailrows
I have tried to add a listener to all rows using this code
[code]
$(document).ready(function(){
getBackendData(aktienaam2,tabelid2,tabelnavid2);
}
function getBackendData(aktie,tabelid,tabelnavid) {
jQuery.getJSON(dblocation + "wqsGetData?openagent&action=" + aktie + sessieparameters + "&callback=?",
function(data) {
notesData = data;
if (data.error){alert(data.error);return false;}
$(tabelid).html(''+ data.gegevens).show();
$(tabelnavid).html(sortnavigatie).show();
$(data.tabelid)
.tablesorter({widthFixed: true, widgets: ['zebra']})
.tablesorterPager({container: $(tabelnavid)});
addDetailListener(notesData.tabelid);
}
);
}
});
function addDetailListener (tableid) {
oTable = $(tableid).dataTable();
$('td img', oTable.fnGetNodes() ).each( function () {
$(this).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";
oTable.fnClose( nTr );
}
else
{
/* Open this row */
this.src = "details_close.png";
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
} );
} );
}
function fnFormatDetails ( nTr )
{
var i = nTr.id.lastIndexOf("_");
sOut = notesData.details[nTr.id.substr(i+1)];
return sOut;
}
[/code]
The result is that only 10 rows (the 10 that are displayed initially) have the event listener. What am i missing here. I thought i followed the example, but i must be doing something wrong.
[code]
$(document).ready(function(){
getBackendData(aktienaam2,tabelid2,tabelnavid2);
}
function getBackendData(aktie,tabelid,tabelnavid) {
jQuery.getJSON(dblocation + "wqsGetData?openagent&action=" + aktie + sessieparameters + "&callback=?",
function(data) {
notesData = data;
if (data.error){alert(data.error);return false;}
$(tabelid).html(''+ data.gegevens).show();
$(tabelnavid).html(sortnavigatie).show();
$(data.tabelid)
.tablesorter({widthFixed: true, widgets: ['zebra']})
.tablesorterPager({container: $(tabelnavid)});
addDetailListener(notesData.tabelid);
}
);
}
});
function addDetailListener (tableid) {
oTable = $(tableid).dataTable();
$('td img', oTable.fnGetNodes() ).each( function () {
$(this).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";
oTable.fnClose( nTr );
}
else
{
/* Open this row */
this.src = "details_close.png";
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
} );
} );
}
function fnFormatDetails ( nTr )
{
var i = nTr.id.lastIndexOf("_");
sOut = notesData.details[nTr.id.substr(i+1)];
return sOut;
}
[/code]
The result is that only 10 rows (the 10 that are displayed initially) have the event listener. What am i missing here. I thought i followed the example, but i must be doing something wrong.
This discussion has been closed.