I’m trying to implement submenus in site navigation that are only visible if a user has the proper credentials. I’m using a visible_calc statement with the submenu to determine if the submenu should be shown. When I do this, the header for the submenu shows up correctly based on the credentials, but none of the submenu items show up (i.e. if I click on the submenu header, nothing happens). If I login with a different user ID that doesn’t have the credentials, I don’t see the submenu header. Here’s an example of the code I’m using; it’s dummy data and the paths are obviously not real. The exact same behavior happens with real paths.
When the user logs in, I assigned to the app model a field called “userType” (this also gets verified and re-defined using a global_before call). The Dev Tools - App shows that userType is indeed populated correctly.
I’m sort of at a loss here. I really need conditionally shown submenus. Of note, if I don’t apply a visible_calc to the overall submenu and instead put it on each individual submenu item, then that behaves as expected, but I end up seeing the submenu header. That won’t work for my application.
After a test, this appears to be a bug where once hidden subs can not become visible after the parent visible_valc evaluates true.
Workaround:
Instead of hiding the section Header, add a calc to the label key and return an empty string
Add a visible calc to the child items as normal.
@delfs This would be a nice thing to have. I was able to get this to partially work, but it’s too “delicate” to push into production. If the window is refreshed or if the user leaves the site and comes back without having to log back in, it breaks the conditionally shown submenu items. When they do that, the parent menu item shows up, but the submenu items do not. The fix you had (adding. a calc to the label key) results in blank spaces in the menu if they don’t have permission. Not really what I’m looking for.
I tested this morning. It looks like it has not been fixed. Still the same behaviour. I hope I am wrong . Can someone confirm whether it is already fixed or not ? Thank you
Hey! We are investigating making these changes. I have recreated this issue and have found it does not reproduce. If anyone is still finding this to be an issue please leave a comment so we can take a look at it. @Alex@LeongMengFoo
@Christina Hi Christina, I tested this again, and I’m still seeing the same behavior as before.
With my use case, I need to have multiple sub-menus that are dependent visible based on app model data (i.e. user permissions). To set this up, I use a visible_calc for the parent item and for the submenu items. When the user first logs in, the conditionally shown menu items and submenus show correctly (i.e. the user clicks on the parent item and the menu expands to show the submenu items). But, if the user reloads the browser window or navigates to a different site and comes back, the conditionally shown parent menu shows up but the submenu items do not. If you click on the parent menu item, nothing happens; the menu does not expand to show the submenu items. The only way to reset this is for the user to log out and back in. This is a bigger issue due to the fact that BF users seem to have very very long lived logins (i.e., they leave, come back at a later point, and are still logged into the system - even if they’ve closed the browser).
Other variations I’ve tried:
If you instead only put the visible_calcs on the submenu items and do not put it on the parent menu item, then the submenus items work as intended, but the parent menu items will show up regardless. I don’t want users to see menu options they can’t get into.
Charles’ solution was to put a label_calc for the parent menu item based on the app model data and not have a label_calc. The issue here is you end up with a “blank” spot on the menu.
Hope this helps. I really do need to use conditionally shown submenu so I can expand the overall app functionality.
Hi i see, i think it would be best for us to schedule a zoom call. You can message on slack/email christina@delfsengineering.ca if you can’t find me on slack, let me know your slack username.
@Christina.
Hi. Here is my setup. When app.accessMyLeave is false, the section Header is hidden. This is the correct behaviour. However, when app.accessMyLeave is true, though the section Header is display but the sub are invisible. Thank you