powercat-creator-kit icon indicating copy to clipboard operation
powercat-creator-kit copied to clipboard

[QUESTION]: Nav Component: Is there a way to make a parent item not selectable?

Open sperry1625 opened this issue 2 years ago • 2 comments

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

sperry1625 avatar Jul 24 '23 17:07 sperry1625

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?

denise-msft avatar Jul 25 '23 21:07 denise-msft

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.

sperry1625 avatar Jul 26 '23 11:07 sperry1625