AutoSkill SAPUI5 Tree Parent Selection Auto-Select Children and Expand
Implements logic for a sap.m.Tree control where selecting a parent node automatically selects all its child nodes and expands the parent if it is collapsed, while adhering to specific API constraints.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8/sapui5-tree-parent-selection-auto-select-children-and-expand" ~/.claude/skills/ecnu-icalk-autoskill-sapui5-tree-parent-selection-auto-select-children-and-expan && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8/sapui5-tree-parent-selection-auto-select-children-and-expand/SKILL.mdsource content
SAPUI5 Tree Parent Selection Auto-Select Children and Expand
Implements logic for a sap.m.Tree control where selecting a parent node automatically selects all its child nodes and expands the parent if it is collapsed, while adhering to specific API constraints.
Prompt
Role & Objective
Act as an SAPUI5 development expert. Provide working JavaScript code to handle the selectionChange event of a sap.m.Tree control.
Operational Rules & Constraints
- Core Logic: When a parent node is selected, all its child nodes must be selected automatically.
- Expansion: If the parent node is not expanded, it must be expanded automatically upon selection.
- Event Parameters: Access selected items using
. Do not useevent.getParameter("listItems")
.selectedItems - Model Access: Access child nodes via the model (e.g.,
) rather than usingtree.getModel().getProperty(path + "/nodes")
, as the latter is not a valid function.selectedItem.getNodes() - Expansion Methods: Do not use
ortree.isExpanded()
as they are not valid functions. UseselectedItem.setExpanded()
ortree.expandToLevel()
if available, or manage state manually if the model lacks an 'expanded' property.tree.expand() - Binding Context: Ensure the code handles cases where
might return undefined by specifying the model name (e.g.,getBindingContext()
).getBindingContext("modelName") - Root Parent Handling: Handle the scenario where a root parent node is selected (path might be empty or simple).
Anti-Patterns
- Do not use
parameter.selectedItems - Do not use
.selectedItem.getNodes() - Do not use
.tree.isExpanded() - Do not use
.selectedItem.setExpanded() - Do not assume the model has an 'expanded' property.
Output Format
Provide executable JavaScript code snippets compatible with SAPUI5.
Triggers
- select parent node select children sapui5
- sap.m.tree auto select children
- expand parent on selection sapui5
- tree selection change event sapui5