Problem with iDisplayLength
Problem with iDisplayLength
peipst9lker
Posts: 11Questions: 0Answers: 0
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?
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?
This discussion has been closed.
Replies
Will it work if you remove the quotes so that value="25" becomes value=25 ?
Then I changed the initialisation to
[code]
"iDisplayLength": parseInt($("#entries_per_page").val()),
[/code]
Now it works properly! Thanks PeteB helped me a lot!