Enhancement
Major
Detail
Detail
Detail
#27996
Delete does not appear in the context menu of multi-selection components
The table-specific context menu entries are no longer displayed.
Analysis
Example tl:GridComponent: The context menu is created by tl:ContextMenuOpener. It uses ContentControl.createContextMenu(String) for this purpose. The ContentControl is the one for the grid. And this uses ComponentContextMenuFactory.Provider which was created by tl :PlainComponentContextMenuFactory. There is an extra derivation GridContextMenuFactory.Provider. The reason is that the Config Property getComponentControlProvider on the grid has tl:ControlRepresentableCP as its default. And the property getContextMenuFactory only has the PlainComponentContextMenuFactory.
tl:GridContextMenuFactory is also stored separately in tl:GridTableConfig, a derivation of tl:TableConfig. The tl:TableData accesses this and the tl:TableControl accesses it. However, the latter is never called by the tl:ContextMenuOpener. It always calls ContentControl.createContextMenu(String) instead of TableControl.createContextMenu(String) as described above.
The reason for this is the HTML structure: The HTML attribute data-context-menu must be set for a context menu to be opened. This is only set on the HTML tag for the entire component. But since #27350 ("Render tables via HTML templates") it is no longer set on the table lines(tr tags). As a result, nothing is found on the tr tag when searching outside the HTML tree, but only on the tag for the entire component. As a result, the tl:TableControl and therefore also the tl:GridContextMenuFactory are never called.
Test
- In the demo, select an object with several children in the tree.
- Select several of these children in the grid next to it.
- Open the context menu on one of the selected children.
- Among other things, there must be a "Delete" button.
- This must delete exactly the selected children.
- Select several children again.
- Open the context menu on an unselected child.
- Among other things, there must be a "Delete" button.
- This may only delete this one unselected child.