iDisplayLength causing "Cannot read property 'nTR' of undefined" error when changing page.

iDisplayLength causing "Cannot read property 'nTR' of undefined" error when changing page.

kasperskov303kasperskov303 Posts: 9Questions: 1Answers: 0
edited July 2013 in General
Hi Allan/you other guys

Im setting my iDisplayLength in my initialization of my table dynamically from a function parameter like this
[code]
function buildDatatable(length) {
oTable = $('#datatableActivities1').dataTable({
//Loads of unrelated options
"iDisplayLength": length
//more options
});
[/code]
When page is loaded and I try to change the page I get the error: Uncaught TypeError: Cannot read property 'nTr' of undefined.
Now here is the even more strange part. If I then change the length from the drop down list, the paging works fine.
This issue also occurs exactly the same way if I choose to alter the iDisplayLength with a redraw:
[code]
function buildDatatable(length) {
oTable = $('#datatableActivities1').dataTable({
//Options
});
var oSettings = oTable.fnSettings();
oSettings._iDisplayLength = length;
oTable.fnDraw();
[/code]

Any ideas? I'm using some plugins, doing callbacks and binding events the the table also. If you thing that is relevant, I get post that as well.

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Can you link to a test case showing the problem please?

    Allan
  • kasperskov303kasperskov303 Posts: 9Questions: 1Answers: 0
    @allan No I cant im sorry. Its a closed system.
    But heres a small video showing the error:
    http://speedy.sh/PAUqv/iDisplayLength.avi
  • kasperskov303kasperskov303 Posts: 9Questions: 1Answers: 0
    edited July 2013
    Allan I know you're busy. Sorry. But i'm stuck. Do you have any clue?
  • kasperskov303kasperskov303 Posts: 9Questions: 1Answers: 0
    Never mind. I reinitialized the datatable and it worked. Dunno why.
This discussion has been closed.