iDisplayLength question (ver 1.8.0)

iDisplayLength question (ver 1.8.0)

donsomdonsom Posts: 5Questions: 0Answers: 0
edited June 2011 in General
I am attempting to set the display length based on a value stored in a cookie (for long term). I can set the iDisplayLength to a literal number like 50 and it works fine. However when I use a variable the first page looks fine but the later pages seem to lose where they are at and not display the correct number on rows per page. For example if my setting is 25 then the first page displays 25 (Showing 1 to 025 of 78 entries) and the second page displays 53 (26 to 78 of 78 entries )and the third page shows 28 (51 to 78 of 78 entries) and the fourth shows 3 (Showing 76 to 78 of 78 entries). The select is set to the correct value but the pagination seems confused. Let me know if you have ideas on how to correct this.


page_size = $.cookie(pg_size_cookie);

if (page_size == null)
page_size = 10;


var datatable = $('#DASHBOARD_TBL').dataTable({
"oLanguage": {
"sSearch": "Filter All Columns:",
"sLengthMenu": 'Display '+
'10'+
'25'+
'50'+
'100'+
'All'+
' records'
},
"sPaginationType": "full_numbers",
"aaSorting": [],
"iDisplayLength": page_size,
"aoColumns": [
null,
null,
null,
null,
{ "sSortDataType": "priority", "sType": "numeric" },
null,
null,
null,
null,
null,
null
]
});

Replies

  • donsomdonsom Posts: 5Questions: 0Answers: 0
    I resolved this myself. I had to convert the cookie value to a number and it works now.
This discussion has been closed.