Strange behavior on page load

Strange behavior on page load

ThornThorn Posts: 2Questions: 0Answers: 0
edited March 2009 in General
Hello. I'm testing DataTables for a new project and I'm experiencing this weird behavior. When page loads, the table has all rows, no "sorting" classes on column headers, and no odd/even classes on rows. When I click a column header or any pagination control, the table jumps to normal (10 rows, with classes set).

Datatable initialization (parameters don't seem to have any effect on this):

$().ready(function() {

$("#dttest").dataTable({
"bStateSave": false
,"bProcessing": true
,"aaSorting": [[1, "asc" ], [2, "asc" ], [3, "asc" ]]
,"sPaginationType": "full_numbers"
});

});

Table structure:




ID
Title
Content




id
title
content

(81 more rows)



Tested with datatables 1.4.3, jquery 1.3.1 and 1.3.2, firefox 3.0.7, opera 9.63 and ie6.

Replies

  • ThornThorn Posts: 2Questions: 0Answers: 0
    Actually the problem is caused by aaSorting when it contains a column index that's out of range.
  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Hi Thorn,

    From your second post it looks like you've you've probably got this issue sorted already - but quickly: remember array indexes start at 0! So the index of the first column is actually 0. So if you want to sort your three columns you need to use the column index values:

    [code]
    [[0, "asc" ], [1, "asc" ], [2, "asc" ]]
    [/code]

    Hope this helps,
    Allan
This discussion has been closed.