table click event fires sEcho number of times
table click event fires sEcho number of times
FredFlintstone
Posts: 24Questions: 0Answers: 0
again, apologies if i'm missing something. if i have a table of paged data and page back and forwards through it, the value of sEcho is incremented with every new page. if i then click on a row, my handler for that event, eg
[code]
"fnDrawCallback": function (oSettings) {
$(myTable).click(function (event) {
alert("W");
if ($(event.target.parentNode).hasClass('row_selected')) {
$(event.target.parentNode).removeClass('row_selected');
}
else {
$(event.target.parentNode).addClass('row_selected');
}
});
$(myTable.fnGetNodes()).dblclick(function () {
var iPos = myTable.fnGetPosition(this);
var aData = oSettings.aoData[iPos]._aData;
window.location.href("/myTable/" + aData.myTableId);
});
},
[/code]
fires sEcho times. is this behaviour by design? seems a tad inefficient and i'm sure i'm missing something? thanks.
[code]
"fnDrawCallback": function (oSettings) {
$(myTable).click(function (event) {
alert("W");
if ($(event.target.parentNode).hasClass('row_selected')) {
$(event.target.parentNode).removeClass('row_selected');
}
else {
$(event.target.parentNode).addClass('row_selected');
}
});
$(myTable.fnGetNodes()).dblclick(function () {
var iPos = myTable.fnGetPosition(this);
var aData = oSettings.aoData[iPos]._aData;
window.location.href("/myTable/" + aData.myTableId);
});
},
[/code]
fires sEcho times. is this behaviour by design? seems a tad inefficient and i'm sure i'm missing something? thanks.
This discussion has been closed.
Replies
http://datatables.net/forums/discussion/8704/ajax-datasource-and-and-single-row-select/p1
sorry for not searching more thoroughly...
Having said that, since you are using static events, I actually would have expected your code above to work. live / delicate events would certainly suffer, and non-server-side processing tables, but a table with server-side processing enabled, should actually be able to handle that (although it would leak RAM since you aren't unbinding the jQuery event handlers).
Allan