From e8e6ceb29e34019ef16bc105dbcbf333075599df Mon Sep 17 00:00:00 2001 From: acognet Date: Tue, 25 Jan 2022 08:54:40 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B04529=20-=20Object=20list:=20Count=20in?= =?UTF-8?q?=20header=20not=20updated=20when=20refreshing=20through=20the?= =?UTF-8?q?=20icon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base/Component/DataTable/DataTableUIBlockFactory.php | 4 ++-- templates/base/components/datatable/layout.ready.js.twig | 6 ++++-- .../datatable/static/formtable/layout.ready.js.twig | 3 ++- .../base/components/datatable/static/layout.ready.js.twig | 7 ++++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php b/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php index 72664da99..8b728366b 100644 --- a/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php +++ b/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php @@ -157,11 +157,11 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory } if ($oDataTable->GetOption("select_mode") == 'multiple') { - $sSubTitle =Dict::Format('UI:Pagination:HeaderSelection', $iCount, '0'); + $sSubTitle =Dict::Format('UI:Pagination:HeaderSelection', ''.$iCount.'', '0'); } else { - $sSubTitle = Dict::Format('UI:Pagination:HeaderNoSelection', $iCount); + $sSubTitle = Dict::Format('UI:Pagination:HeaderNoSelection', ''.$iCount.''); } $oContainer->AddSubTitleBlock(new Html($sSubTitle)); if(isset($aExtraParams["panel_icon"]) && strlen($aExtraParams["panel_icon"]) > 0){ diff --git a/templates/base/components/datatable/layout.ready.js.twig b/templates/base/components/datatable/layout.ready.js.twig index 806a99935..4914a402f 100644 --- a/templates/base/components/datatable/layout.ready.js.twig +++ b/templates/base/components/datatable/layout.ready.js.twig @@ -82,7 +82,8 @@ var oTable{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({ } } }, - drawCallback: function () { + drawCallback: function (settings) { + $(this).closest('.ibo-panel').find('.ibo-datatable--result-count').html(settings.json.recordsTotal); if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative") { $(this).closest('.dataTables_wrapper').find('.checkAll')[0].checked = true; @@ -106,7 +107,8 @@ var oTable{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({ }); }, {% else %} - drawCallback: function () { + drawCallback: function (settings) { + $(this).closest('.ibo-panel').find('.ibo-datatable--result-count').html(settings.json.recordsTotal); $(this).closest('.dataTables_wrapper').unblock(); // Hiding pagination if only one page if ($(this).closest('.dataTables_wrapper').find('.dataTables_paginate:last .paginate_button:not(.previous):not(.next)').length < 2) diff --git a/templates/base/components/datatable/static/formtable/layout.ready.js.twig b/templates/base/components/datatable/static/formtable/layout.ready.js.twig index 544910cc7..cbc79dae6 100644 --- a/templates/base/components/datatable/static/formtable/layout.ready.js.twig +++ b/templates/base/components/datatable/static/formtable/layout.ready.js.twig @@ -23,7 +23,8 @@ var oTable{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({ {orderable: false, targets: 0} ], {% endif %} - drawCallback: function () { + drawCallback: function (settings) { + $(this).closest('.ibo-panel').find('.ibo-datatable--result-count').html(settings.json.recordsTotal); // Hiding pagination if only one page if ($(this).closest('.dataTables_wrapper').find('.dataTables_paginate:last .paginate_button:not(.previous):not(.next)').length < 2) { diff --git a/templates/base/components/datatable/static/layout.ready.js.twig b/templates/base/components/datatable/static/layout.ready.js.twig index 0c535fccf..a252c7d19 100644 --- a/templates/base/components/datatable/static/layout.ready.js.twig +++ b/templates/base/components/datatable/static/layout.ready.js.twig @@ -55,7 +55,8 @@ var oTable{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({ }, {% endfor %} ], - drawCallback: function () { + drawCallback: function (settings) { + $(this).closest('.ibo-panel').find('.ibo-datatable--result-count').html(settings.json.recordsTotal); // Hiding pagination if only one page if ($(this).closest('.dataTables_wrapper').find('.dataTables_paginate:last .paginate_button:not(.previous):not(.next)').length < 2) { @@ -65,6 +66,10 @@ var oTable{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({ { $(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').show(); } + if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative") + { + $(this).closest('.dataTables_wrapper').find('.checkAll')[0].checked = true; + } }, initComplete: function () { if (this.api().page.info().pages < 2)