Conditional Rendering on component in drawer not picking up context

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
  • (Edited)
I have a drawer action defined on a table. Within the drawer is a tabset that contains a tab that is conditionally rendered. Currently when the drawer displays, the tab is always displayed for each row or never displayed for each row. It appears that this is based on how the condition evaluates against the first row in the model.

I have attempted to manually update the XML to include a <conditions> element in a few different ways (e.g. tab element) but this does not seem to resolve the issue.

Thoughts on how to ensure that the components within a drawer are conditionally rendered based on the context row?

Steps to reproduce:

1) Create a new tab page for Account
2) Add a drawer row action
3) On the drawer page, add two tabs:
- Details
- Parent Info - Specify conditional rendering to only display this tab if the account has a parent account

Actual Result
Parent Info tab is either displayed for all rows or no rows

Expected Result
Parent Info tab displays based on value of ParentId for each individual row (context specific)

Thank you!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Thanks for pointing this out. I'll pass this on to the dev team.  I'm pretty sure the root cause is that the tabset does not carry a row context. Other components are rendering according to the row context in which they are placed.  But the tabset is always evaluating according to the first row in the model.   So the bug you have found is true for popups as well as drawers - and has been in place since the spring.  DANG! 

A work around for you will be to avoid using tabsets if you want to use conditional rendering in drawers or popups.  Conditonally render a column,  or an entire table,  but just don't try to conditionally render a tab. 

Thanks again. 
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Thanks for confirming Rob. Unfortunately, with Summer '14 we reworking all of our pages to move to drawers and multi-layer drilldown of multiple sets of information related to the row in the context and there really isn't a way that I can think of to segment this information UI wise without a tabset. One possible workaround I can think of is conditionally render each component on a tab so that the tab appears but the contents of the tab is empty. Kind of kludgy but might work for now.

Once you've had a chance to connect with Dev team, can you provide any other potential workarounds and an update as to the decision on whether or not this will be fixed at some point?

Thank you!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hey Rob -

I tried a few things here and unfortunately eliminating tabsets and conditionally rendering the components such as tables and field editors within a drawer is behaving the same and always evaluating against the first row.

I know you guys are looking at some of the drawer related items but wanted to pass this information along since the current workarounds are not working as expected.

The only thing I've been able to have success with is the individual fields of field editors or tables.

Steps to reproduce:

1) Create a new tab page for Account
2) Add a drawer row action
3) On the drawer page:
a) add a table, field editor and panelset for Account and specify conditional rendering on each component to only display the component if the account createddate is not blank.
b) add a field editor with two fields - one for Name and one for created date specifying conditional rendering on createddate field where createddate does not equal blank
4) Preview the page - All components will be displayed at this point for each row
5) Click green plus sign

Actual Result
Only the field editor (step 3b) that does not have conditional rendering is displayed in each row

Expected Result
All components should display in each row except for the new row which should only contain the field editor from Step 3b.

I have granted login access. The test page is called SampleAccountConditionalRenderingDrawerContextRepro.

Thanks!
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Thanks for the additional clarification Barry.  We will get you an update on this matter as soon as we can. 
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
This has been fixed in the latest release of Skuid, 5.12, available from the Skuid releases page:

www.skuidify.com/SkuidReleases
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Just installed 5.12 and all tests around conditional rendering in drawers work as expected, even tabsets!  You guys are awesome, thank you!