Problem with iDisplayLength

Problem with iDisplayLength

peipst9lkerpeipst9lker Posts: 11Questions: 0Answers: 0
edited April 2012 in General
Hello,

In my application users can configure iDisplayLength in their settings. The PHP-Script puts an hidden input field at the top of the page looking like this
[code]

[/code]

My initialisation code
[code]
$('.datatable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"oLanguage": { "sUrl": "lang/de_DE/de_DE-datatables.txt" },
"aoColumns": dtSortCols,
"iDisplayLength": $("#entries_per_page").val()
});
[/code]

Now my problem, is a leading zero. In the bottom left corner of a datatable it says "Showing 1 to 025 of 137 entries"
After changing the select-box to something else its displayed correctly, I already gave out the input value via console.log and it says correctly 25 (no leading zero).

Any idea what is causing this effect and how can I fix this?

Replies

  • PeteBPeteB Posts: 38Questions: 0Answers: 0
    I had a similar problem, it is caused by the value being a 'char' rather than numeric.

    Will it work if you remove the quotes so that value="25" becomes value=25 ?
  • peipst9lkerpeipst9lker Posts: 11Questions: 0Answers: 0
    Good Idea but didn't worked when I edited the input-field.
    Then I changed the initialisation to
    [code]
    "iDisplayLength": parseInt($("#entries_per_page").val()),
    [/code]
    Now it works properly! Thanks PeteB helped me a lot!
This discussion has been closed.