I am trying to conditionally render tabs within a drawer based on whether or not there are rows in the model within that context. I cant seem to get this to work. Any ideas?
Interesting problem. Because while most components within a Drawer or Popup will have defineable Context, the Tab Set won’t.
I think this is possible using the Rendering Condition Type of ‘Snippet returns true’
In the image below, the Parent object on the drawer is Accounts, and the child is Contacts. If there are existing Contact rows in context, I want to render the first tab. But if there are no Contacts on that Account, I only want to render the 2nd tab.
Is that, generally speaking, what you’re trying to achieve?
As for the snippet itself, this thread should be of use: https://community.skuid.com/t/how-can-i-obtain-the-context-row-in-a-javascript-snippet
If you’re hoping to hide the whole tabset for cases in which the drawer doesn’t have any related rows inside, you might try putting the tabset inside a wrapper, and conditionally rendering the wrapper only when the relevant model has rows.
Agreed. That would be a much simpler solution - and you can do that declaratively with no js. But I *think* DannyS is trying to conditionally render individual tabs within a tab set based on Model Context.
Hmm… Could this be done using the Action Framework ‘Before Load Actions’ on the drawer? Maybe to update a set of Ui only checkbox fields that correspond to each individual tab?
Just throwing ideas around. Not sure how viable this is though.
Yes, unfortunately it would be much easier if I wanted to just render the whole tabset. I will first look to see if I can leverage the action framework using the example above. If not I will go the JS route. Thanks!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.