[QUESTION]: Nav Component: Is there a way to make a parent item not selectable?
I would like the parent item in a nav control to expand collapse on click, but select a child when clicked. Either select the first child or whatever the last selected child was.
Is this at all possible?
Regards,
Steven
AB#974
You could try using a variable to auto select one of the nav item children if it has children, by assigning the below formula to the OnChange property, and assigning the Nav's SelectedKey property to the context variable SelectedNavItem.ItemKey:
Set(SelectedNavItem, Coalesce(LookUp(NavItems, ItemParentKey=Self.Selected.ItemKey), Self.Selected));
However, this method keeps the parent expanded for the duration of the session because it will keep selecting the child if the parent is selected. If you do want the ability to collapse a section, which item key should be selected? Should it select the parent as collapsed, or should the variable still hold the page that is now hidden?
I implemented something similar. I also added a flag on the screen that flips every time the parent is selected so I can track the expanded state. Then I only select the child when the parent is being expanded. This still allows for collapsing the parent. It would be nice if the flag was maintained post initial setting.