diff --git a/css/backoffice/components/datatable/_datatableconfig.scss b/css/backoffice/components/datatable/_datatableconfig.scss index 73be36185..81cca6339 100644 --- a/css/backoffice/components/datatable/_datatableconfig.scss +++ b/css/backoffice/components/datatable/_datatableconfig.scss @@ -22,6 +22,9 @@ $ibo-datatableconfig--settings-panel--option--margin-right: $ibo-spacing-200 !de } .ibo-datatableconfig--attributes-panel--per-page--input{ margin: $ibo-datatableconfig--attributes-panel--per-page--input--margin-y $ibo-datatableconfig--attributes-panel--per-page--input--margin-x; + max-width: 4em; + @extend .ibo-input; + display: initial; } .ibo-datatableconfig--settings-panel .ibo-panel--body{ diff --git a/js/dataTables.settings.js b/js/dataTables.settings.js index 77e9cc57e..e37e872d8 100644 --- a/js/dataTables.settings.js +++ b/js/dataTables.settings.js @@ -186,6 +186,11 @@ $(function () { var sSortDirection = 'asc'; var oColumns = $('#datatable_dlg_'+this.options.sListId).find(':itop-fieldsorter').fieldsorter('get_params'); var iPageSize = parseInt($('#datatable_dlg_'+this.options.sListId+' input[name="page_size"]').val(), 10); + // Fallback to default page size in case of invalid number + if (isNaN(iPageSize) || iPageSize <= 0) { + iPageSize = this.options.oDefaultSettings.iDefaultPageSize; + $('#datatable_dlg_'+this.options.sListId+' input[name="page_size"]').val(iPageSize); + } oOptions = {oColumns: oColumns, iPageSize: iPageSize, iDefaultPageSize: iPageSize }; } diff --git a/sources/Controller/AjaxRenderController.php b/sources/Controller/AjaxRenderController.php index 0e7651dd4..4b7f4630c 100644 --- a/sources/Controller/AjaxRenderController.php +++ b/sources/Controller/AjaxRenderController.php @@ -278,7 +278,7 @@ class AjaxRenderController } $sTableId = utils::ReadParam('list_id', ''); - $iLength = utils::ReadParam('end', 10); + $iLength = utils::ReadParam('end', 10, false, utils::ENUM_SANITIZATION_FILTER_INTEGER); $aColumns = utils::ReadParam('columns', array(), false, 'raw_data'); $sSelectMode = utils::ReadParam('select_mode', ''); $aClassAliases = utils::ReadParam('class_aliases', array()); @@ -499,7 +499,7 @@ class AjaxRenderController */ public static function DatatableSaveSettings(): bool { - $iPageSize = utils::ReadParam('page_size', 10); + $iPageSize = utils::ReadParam('page_size', 10, false, utils::ENUM_SANITIZATION_FILTER_INTEGER); $sTableId = utils::ReadParam('table_id', null, false, 'raw_data'); $bSaveAsDefaults = (utils::ReadParam('defaults', 'true') == 'true'); $aClassAliases = utils::ReadParam('class_aliases', array(), false, 'raw_data'); diff --git a/templates/base/components/datatable/config/layout.html.twig b/templates/base/components/datatable/config/layout.html.twig index a40357bbc..f28b1796d 100644 --- a/templates/base/components/datatable/config/layout.html.twig +++ b/templates/base/components/datatable/config/layout.html.twig @@ -20,7 +20,7 @@ -

{{ 'UI:Display_X_ItemsPerPage_prefix'|dict_s }}{{ 'UI:Display_X_ItemsPerPage_suffix'|dict_s }}

+

{{ 'UI:Display_X_ItemsPerPage_prefix'|dict_s }}{{ 'UI:Display_X_ItemsPerPage_suffix'|dict_s }}