I have created a custom component particular for sidemenu that is collapsible by a hamburger icon.
I copied the logic from Creator Kit which functions perfectly but mine doesnt. I don't see any difference in the codes but I am wondering why mine isnt opened by default.
I'll first put here the properties/codes for the Creator Kit - ExpandMenu - custom component.
This is attached to a new app with nothing entered on any of the App's properties(OnStart).
ExpandMenu Width = If(!Self.IsExpanded, 46, 221)
ExpandMenu.DefaultExpanded -- raise OnReset when value changed enabled = true
ExpandMenu.OnReset = Set(IsOpen, ExpandMenu.DefaultExpanded)
ExpandMenu.IsExpanded (output property) = IsOpen
Hamburger icon OnSelect = Set(IsOpen, !IsOpen)
all of the above code works and the side menu by default is opened. Code below will be my own custom menu that I copied the logic but doesn't work.
SideMenu_Collapsible.Width = If(
SideNavigation_Collapsible.MenuExpanded,
250,
70
)
SideMenu_Collapsible.DefaultExpand = true
SideMenu_Collapsible.OnReset -- raise OnReset when value changed enabled = Set(varMenuExpanded, SideMenu_Collapsible.DefaultExpand)
SideMenu_Collapsible.MenuExpanded (output property) = varMenuExpanded
Hamburger Icon OnSelect = Set(varMenuExpanded, !varMenuExpanded)
Image above is the default when the app is first opened
now this is the default of the side menu of the other app. Everything is basically similar.
why is my custom side menu not opened by default???
I noticed that the only difference between two apps are mine are enclosed with containers and the other app isn't. I dont know if this should affect anything but might as well indicate it here.
I have tried resetting before in the OnStart property of the app but I can't reset the component and thought that Resetting the component is impossible in any properties.
Also, I have tried what you suggested and it worked! I guess its a lesson learned that I should not assume that it won't work automatically if it doesnt work with a certain property...
Thanks a lot!
When the app was just launch, variable varMenuExpanded, inside the component is still Blank even you have set DefaultExpand to true
So, all condition reference to this variable will be false and this cause your side menu open in collapse mode
As per my try, this seem to fix the problem, just add Reset() function to screen OnVisible() to reset the component if is MenuExpanded value is Blank
Screen1.OnVisible = If(
SideNavigation_Collapsible_3.MenuExpanded = Blank(),
Reset(SideNavigation_Collapsible_3)
)
However, still didn't find the cause why there is no issue with Creator Kit component. I will keep you posted if I found any clue.
Hope this help!
here it is. Please do let me know if you have downloaded the zip file already. 🙂
Edit: removed it.
oh I thought you wanted this one.
okay wait let me just create the zip file for it.
I'm not sure if I got anything wrong, but I only see the component named ExpandMenu (it's expanded by default).
Can I have the component that you created which doesn't work?
yes sure
Hi @kej
Is it possible to export the app .zip that contains just the component and upload it here?
So I can import to my environment and try debugging.
WarrenBelz
146,651
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional