
Hi,
I follow the documentation here and build a modern nav control using Creator Kit: https://learn.microsoft.com/en-us/power-platform/guidance/creator-kit/nav.
Since I have many screens in my app and all of them need this navigation control, so it made sense to me to build a reusable component, cmpAppNav and insert this component into all of my screens. cmpAppNav has only one control, the Fluent Nav.
I inserted navAppMenu on all of my screens.
My quesiton is...Is there a way to programmatically collapse/expand the sub menu? In other words, is there a way to always keep Category 1 and Category 2 sub menu closed? ItemExpanded property is not the answer since the page only respects the value here on initial load. I want the menu to be closed on every single click event of Page 20/21/30/31. So after the navigation gets triggered (configured in the onSelect), and the user is redirect to the new page, the nav sub menus remain collapsed when the user opens the navigation again (by clicking the hambuger icon).
Here is my nav items:
Table(
{
ItemKey: "1",
ItemDisplayName: "Home",
ItemIconName: "Home"
},
{
ItemKey: "2",
ItemDisplayName: "Category 1"
},
{
ItemKey: "3",
ItemDisplayName: " Category 2"
},
{
ItemKey: "20",
ItemDisplayName: "Page 20",
ItemParentKey: "2",
ItemIconName: "Assign"
},
{
ItemKey: "21",
ItemDisplayName: "Page 21",
ItemParentKey: "2",
ItemIconName: "Manufacturing"
},
{
ItemKey: "30",
ItemDisplayName: "Page 30",
ItemParentKey: "3",
ItemIconName: "BIDashboard"
},
{
ItemKey: "31",
ItemDisplayName: " Page 31",
ItemParentKey: "3",
ItemIconName: "Repair"
}
)
I appreciate your time reading this post!