enhancement
major
major
major
#29791
TL Views table: the row activation button runs the activation command without selecting its row, so commands reading the selection channel see another row (wrong breadcrumb label)
Affects 8.0.0-alpha10, <table> with <on-activate> (TableElement, RowCommandColumn, TableViewControl); introduced with the activation button of #29544.
Specification
#29544 and the TableElement.Config#getOnActivate() JavaDoc: "The activated row becomes the table's selection first, then the command runs with that row as its input", and the activation button "runs the activation command for that row" - the same command model serves both.
Defect
The two ways of activating a row differ:
- Gesture (double-click / Enter): TableViewControl.activateRow(int) calls selectOnly(rowIndex) - the selection channel receives the row - and then ActivationHandler.rowActivated(row).
- Button of the pinned command column: RowCommandColumn.button(...) builds new ReactButtonControl(cellContext, label, unused -> model.execute(context, row)) - the command runs with the row as input, but the table's selection is not touched.
Everything in the activation command that reads the selection channel instead of the command input therefore sees the previously selected row, or nothing. The prominent case is the breadcrumb label of a drill-down: NavigatePushCommand resolves <frame-label class="...ScriptedTileLabel" inputs="…"> at push time from caller-scope channels (ScriptedTileLabel.compute(ViewContext)), and the usual configuration names the table's selection channel there. The same holds for <bind>`s of `NavigatePushCommand (captured from caller channels) and any <execute-script> with <inputs> on the selection.
Reproduction
com.top_logic.demo.react, WEB-INF/views/projects/overview.view.xml (selection="project", <on-activate class="…NavigatePushCommand" bind-input-to="project"> with <frame-label … inputs="project">):
- Open *Projects* with at least two projects A and B; select nothing.
- Press the chevron (Open) button of row A: the breadcrumb shows the view path projects/milestones.view.xml instead of A's name (label expression got null).
- Go back, click row B (selection = B), press the chevron button of row A: the frame shows project A, the breadcrumb says B.
A double-click on row A shows the correct label in both cases. Reproduced identically in an application (E-Home, projects/overview.view.xml): selected project "EHomeDemo", button of row "Test" → breadcrumb "EHomeDemo", Properties tab shows "Test".
Expected
The button behaves like the gesture: it selects its row (writes the selection channel) before running the command, e.g. by routing the button through the table's own activation (activateRow / activateByKey) instead of calling the command model directly. That also makes the recorded scripted-test step identical for both ways (activateByKey).
Lösung
Der Aktivierungs-Button einer Zeile läuft über die Aktivierung der Tabelle selbst statt das Kommando direkt auszuführen:
- TableViewControl.activate(row) aktiviert die Zeile eines Fachobjekts genau wie Doppelklick/Enter: die Zeile wird zur Selektion (der Selektionskanal erhält sie), danach läuft der Aktivierungs-Handler mit ihr.
- RowSetTableControl.activate(row) (Formular-Tabellen) delegiert an die jeweils aktuelle innere Tabelle.
- RowCommandColumn.RowCommand trägt die Aktion, die der Button einer Zeile ausführt; das Kommando-Modell bestimmt weiterhin Icon, Beschriftung und Ausführbarkeit pro Zeile. Der Aktivierungs-Button von <table> (TableElement, AbstractTableElement) übergibt als Aktion die Aktivierung der Tabelle.
Nicht enthalten: Ein Klick auf den Button wird im Scripted-Test weiterhin als Button-Klick aufgezeichnet (nicht als activateByKey); beim Abspielen wählt er die Zeile über denselben Weg korrekt aus.