From 2d39cc6e9332e2615ff291606331a4239541d711 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Sun, 26 Apr 2026 15:14:06 +0200 Subject: [PATCH] Objects list: Add tree group by option to DataTables UIBlock --- js/dataTables.tree-grouping.js | 359 ++++++++++++++++++ .../UI/Base/Component/DataTable/DataTable.php | 1 + .../DataTable/DataTableUIBlockFactory.php | 8 + .../components/datatable/layout.ready.js.twig | 128 ++++++- 4 files changed, 493 insertions(+), 3 deletions(-) create mode 100644 js/dataTables.tree-grouping.js diff --git a/js/dataTables.tree-grouping.js b/js/dataTables.tree-grouping.js new file mode 100644 index 000000000..bfb33aa02 --- /dev/null +++ b/js/dataTables.tree-grouping.js @@ -0,0 +1,359 @@ +/** + * External key grouping (tree display) for iTop DataTables. + * + * Activated when a DataTable has the 'sTreeGroupingAttr' option set (via DashletObjectList). + * Transforms a flat list of objects into an expandable/collapsible tree grouped by parent ID. + * + * @copyright Copyright (C) 2010-2024 Combodo SAS + * @license http://opensource.org/licenses/AGPL-3.0 + */ +var iTopDataTableExternalKeyGrouping = (function ($) { + 'use strict'; + + // Inject CSS once + var bCssInjected = false; + function _injectCss() { + if (bCssInjected) { + return; + } + bCssInjected = true; + $('