From d0c1f650d189cf9c35ac6a0a16b6dc4cce223e2c Mon Sep 17 00:00:00 2001 From: acognet Date: Mon, 13 Dec 2021 18:59:27 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B03816=20-=20Migrate=20module=20to=20new?= =?UTF-8?q?=20UIBlock=20system=20:=20Bulk=20Event=20Management=20-=20add?= =?UTF-8?q?=20count=20of=20selected=20items?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/backoffice/components/_datatable.scss | 4 ++++ js/dataTables.main.js | 2 ++ .../Component/DataTable/DataTableUIBlockFactory.php | 11 ++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/css/backoffice/components/_datatable.scss b/css/backoffice/components/_datatable.scss index 3fe638983..78ec80a7d 100644 --- a/css/backoffice/components/_datatable.scss +++ b/css/backoffice/components/_datatable.scss @@ -120,4 +120,8 @@ $ibo-fieldsorter--selected--background-color: $ibo-color-blue-200 !default; background-color: $ibo-datatable--row--background-color--is-selected; } } +} + +.ibo-datatable--selected-count{ + padding-right: 0.2em; } \ No newline at end of file diff --git a/js/dataTables.main.js b/js/dataTables.main.js index 7c7cd2904..86740209c 100644 --- a/js/dataTables.main.js +++ b/js/dataTables.main.js @@ -49,8 +49,10 @@ function updateDataTableSelection(listId, tableId) { if (selectionMode === 'negative') { let total = $('#'+tableId).DataTable().page.info()["recordsTotal"]; selectionCount.val(total-currentSelection.length); + $('#'+tableId).closest('.ibo-panel').find('.ibo-datatable--selected-count').html(total-currentSelection.length); } else { selectionCount.val(currentSelection.length); + $('#'+tableId).closest('.ibo-panel').find('.ibo-datatable--selected-count').html(currentSelection.length); } selectionCount.trigger('change'); diff --git a/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php b/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php index e90565a86..72664da99 100644 --- a/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php +++ b/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php @@ -16,6 +16,7 @@ use Combodo\iTop\Application\UI\Base\Component\CollapsibleSection\CollapsibleSec use Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\FormTable\FormTable; use Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\FormTableRow\FormTableRow; use Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\StaticTable; +use Combodo\iTop\Application\UI\Base\Component\Html\Html; use Combodo\iTop\Application\UI\Base\Component\Html\HtmlFactory; use Combodo\iTop\Application\UI\Base\Component\Panel\PanelUIBlockFactory; use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory; @@ -154,7 +155,15 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory $oContainer->SetTitle($aExtraParams['panel_title']); } } - $oContainer->SetSubTitle(Dict::Format("UI:Pagination:HeaderNoSelection", $iCount)); + if ($oDataTable->GetOption("select_mode") == 'multiple') + { + $sSubTitle =Dict::Format('UI:Pagination:HeaderSelection', $iCount, '0'); + } + else + { + $sSubTitle = Dict::Format('UI:Pagination:HeaderNoSelection', $iCount); + } + $oContainer->AddSubTitleBlock(new Html($sSubTitle)); if(isset($aExtraParams["panel_icon"]) && strlen($aExtraParams["panel_icon"]) > 0){ $oContainer->SetIcon($aExtraParams["panel_icon"]); }