Can any security or enabling be set for individual tabs on a tab container, or a way to make them hidden? Why let users drool over things they can’t have access to?
I don’t know about container security, though I suspect you can. I do know that you can set visibility using the session/props/auth/securitylevels property, so maybe take a look at that.
I don’t want to hide the entire container, just certain tabs.
From what I’ve tried, you can sort of hide tabs like what you’re asking, but it’s a bit of a puzzle and might have some side effects.
The way I tried was to have a binding on
session.auth.user.roles with a script transform. You can choose which tabs to show or hide programatically based on the roles the user has (assuming they’ve signed in). In removing an element from the
props.tabs array, the view in the tab container will continue to exist while removing the tab on the top (and thus the ability to swap to that tab).
The thing that makes this difficult is that the views you drag into the tab container will always match the index of the tab. This means if you had 3 tabs with 3 views, and you wanted to hide the middle one, you couldn’t; you would have to put the middle view at the end. If you were to delete the middle item in the
props.tabs array (thinking you could hide the tab), the last item in the array would slide left, and your 2nd tab would have the 3rd tab’s text, but would show the 2nd tab’s view.
So, the problem gets complex if you’re trying to hide more than a couple views, or if you want to have many different configurations.
If you do need something with more control, you could do something like put embedded views into each tab, then use a property change script on your tab container’s
props.currentTabIndex to send
system.perspective.sendMessage() messages with payloads denoting which view to show at which index (which your embedded views would then need to handle).
Sorry for the wall of text; this was a harder problem to approach than I originally thought, lol.
Sounds like a good candidates for an ideas suggestion