Fixed an issue that occurred if you had an option in the pager dropdown with the same value as the total amount of table rows. When you selected such an option, the option with the value "all" was selected. (#1364)

This commit is contained in:
Simen Flatby 2017-03-21 18:50:33 +01:00 committed by Rob Garrison
parent 51ee4d4507
commit 82889c6a92

View File

@ -820,7 +820,9 @@
setPageSize = function(table, size, p) { setPageSize = function(table, size, p) {
p.size = parsePageSize( p, size, 'get' ); p.size = parsePageSize( p, size, 'get' );
p.$container.find(p.cssPageSize).val( parsePageSize( p, p.size, 'set' ) ); var updatedPageSize = parsePageSize( p, p.size, 'set' );
p.$container.find(p.cssPageSize).val( updatedPageSize !== 'all' ? updatedPageSize :
(p.$container.find(p.cssPageSize.concat(' option[value="').concat(size).concat('"]')).length !== 0 ? size : updatedPageSize) );
$.data(table, 'pagerLastPage', parsePageNumber( table, p ) ); $.data(table, 'pagerLastPage', parsePageNumber( table, p ) );
$.data(table, 'pagerLastSize', p.size); $.data(table, 'pagerLastSize', p.size);
p.totalPages = p.size === 'all' ? 1 : Math.ceil( p.totalRows / p.size ); p.totalPages = p.size === 'all' ? 1 : Math.ceil( p.totalRows / p.size );