Conditional Rendering of Tabs within Drawer Not Working

edited February 4 in Questions
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?

Comments

  • edited October 2017
    Interesting problem. Because while most components within a Drawer or Popup will have defineable Context, the Tab Set won't.
    image

    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?
    image

    As for the snippet itself, this thread should be of use: https://community.skuid.com/skuid/topics/how-can-i-obtain-the-context-row-in-a-javascript-snippet

  • Mark DeSimoneMark DeSimone 🛠️ 
    edited February 4
    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. 
  • edited April 2017
    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?image

    Just throwing ideas around. Not sure how viable this is though.
  • edited April 2017
    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!
Sign In or Register to comment.