“Stop running this script” when using fnGetPosition

“Stop running this script” when using fnGetPosition

dkaganovichdkaganovich Posts: 2Questions: 0Answers: 0
edited November 2013 in DataTables 1.8
Hi,

When total number of records grows above 1000 and when I click on ALL (show all records) I begin to get “Stop running this script”. Caused by recursive call of fnGetPosition (var dataPosition = this.fnGetPosition(nRow)). I need position to be stored with the row so I can retrieve it later to use with fnGetData.
Is there a way to store position within the record at the time of creation?
I also, tried to retrieve position at the time of click (handleClickOnEditImage), but was not successful.
The snapshot of code is below. I am using IE8, and jquery.dataTables.js V: 1.8.1

that.displayTable = function () {
var oTable = $('#example').dataTable( {
"bJQueryUI": true,
"bAutoWidth":false,
"bProcessing":true,
"aaData": dpData.dataValues,
"sPaginationType": "full_numbers",
"aLengthMenu": [[13, 50, -1], ["Page", 50, "All"]] ,
"sScrollY": "331", //visible part of the table
"sScrollX": "100%",
"sScrollXInner": parseInt(dpData.dataProperties.length * 150),
"sDom": '<"H"C<"tableTitle"><"addButton">fr>t<"F"ilp>',
"bDeferRender": true,
"oColVis": {"activate": "click"},
"oLanguage": {"sSearch": "Filter:"},
"fnRowCallback": rowCallBack
} );
DP.currentTable = oTable;
return oTable;
};

var rowCallBack = function( nRow, aData, iDisplayIndex ) {
var dataPosition = this.fnGetPosition(nRow),
editImage = ' ';
$(nRow).find('td:first').find('.ellipsis').prepend(editImage).prepend(nRow);
return nRow;
};

var chosenRowData = DP.currentTable.fnGetData(parseInt(dataPosition));

Replies

  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin
    > jquery.dataTables.js V: 1.8.1

    Try 1.9+. fnGetPosition is massively faster in the new versions.

    Allan
  • dkaganovichdkaganovich Posts: 2Questions: 0Answers: 0
    Thank you for your advice. Unfortunately, even so I am not using fnStateLoadCallback and fnStateSaveCallback when I updated to 1.9, I got js errors and most of my customizations stopped working. Rewriting the app is not an option for me.
  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin
    That's a shame. There is a blog post about the fnStateLoadCallback etc change here: http://datatables.net/blog/localStorage_for_state_saving .

    How many rows are being shown?

    Allan
This discussion has been closed.