enhancement
major
major
major
#29824
TL Views table: "Standard wiederherstellen" in the column selection drops a declared group-by (and does not restore the declared sort)
tl-layout-view / tl-layout-react 8.0.0-alpha10, <table group-by="...">.
Problem
The column selection dialog ("Spalten") of a React table offers "Standard wiederherstellen". For a table that declares a grouping, the reset removes it: com.top_logic.demo.react, Demos → Tabellenspalten → Dynamische Spalten declares group-by="initial" and starts grouped by "Anfangsbuchstabe"; after "Standard wiederherstellen" the rows are shown ungrouped for the rest of the session (on the next visit the declared grouping is back, since the view reads an empty persisted grouping as "never grouped"). The declared sort order (sort="ASC" on a column) is not restored by the reset either; the user's current sort stays. Column widths and the frozen-column count the user set stay as well.
Cause
TableViewControl.handleOpenColumnSelect() (com.top_logic.layout.react) resets with
{{{#!java setGroupedColumn(null); applyColumns(_view.defaultColumnOrder()); }}}
i.e. it assumes a table is defined ungrouped. DefaultTableView (com.top_logic) keeps no copy of the declared initial state: restore() replaces the one _state with the persisted one, and only the hidden-by-default column set survives for defaultColumnOrder(). So the declared grouping (and sort) is not available for a reset.
Lösung
"Standard wiederherstellen" restores the whole declared arrangement of the table: the declared columns and their order, the columns hidden by default, the declared grouping (group-by), the declared sort, the default column widths and the declared number of frozen columns. Filters, the search term, the selection and the expansion state are not touched; they have their own controls.
- DefaultTableView keeps a copy of the declared initial state it is constructed with (taken before the personalization is restored); TableViewState gets a copy().
- TableView#resetToDefaults() restores that arrangement into the live state, informs the row source about order and grouping, persists the result and notifies the listeners. It replaces defaultColumnOrder(), whose only use was the reset.
- The reset button of TableViewControl calls it and refreshes the control like a column change and a regrouping do (selected group keys, selection positions, cells, grouping state of the client).
- Tests in TestDefaultTableView; demo check in Demos → Tabellenspalten → Dynamische Spalten.