Context condition properties not displayed

  • 1
  • Problem
  • Updated 3 years ago
  • Acknowledged
For a component that supports context, when a new context condition is added, the properties do not display for the condition when a model has not been selected for the component.

Steps to Reproduce:

Scenario 1:
1) Create new blank page
2) Add page title
3) Add button to page title that shows popup
4) Add page title to popup
5) Add condition to page title on popup
6) Click the condition that was created

Expected Behavior
Since there is no model even available, possibly hide the "Context" category completely.  Short of that, don't allow a condition to be added.  Worst case, display a message in the properties window indicating that you must select a model to configure the condition.  One scenario here is that you have a model on a component and set a bunch of conditions but then either remove the model or set the model to 'None' (if it's applicable for that component).  In this case, hiding the category completely likely makes the most sense I would think.

Actual Behavior
No properties are displayed

Scenario 2:
1) Create a new account detail page
2) Add button to page title that shows popup
3) Add page title to popup
4) Add condition to page title popup
6) Click the condition that was created

Expected Behavior
See Above

Actual Behavior
No properties are displayed

Note -
1) if you explicitly change/set the model or save the page, the context condition properties are displayed.  In the case of scenario 2, even though the model is required and there is a model, the state.attr('model') does not yet have a value (until you explicitly set or save page)
2) The reason no context properties are displayed in because in "function t(a)" of skuidBuilder.js, propsFunction looks for a model and if it doesn't find one, returns false.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb

Posted 3 years ago

  • 1
Photo of JD Bell

JD Bell, Senior Product Engineer

  • 2,996 Points 2k badge 2x thumb
Thanks Barry. The expected behavior in this case should probably be that the Context tab would be hidden.

When a component displays data from a model, it displays all of the data from that model by default. But when a component is displayed within the context of a row (either from the same model or a different one), context conditions give you the ability to filter which rows from the component's model should be visible.

So, for example, if you have an accounts model and a table, and that table has a drawer which can display contacts associated with each account, then you'd need to filter the contacts table in the drawer to only display records associated with the account in context (since the contacts model may contain records for many accounts simultaneously).

If the component does not have an associated model, then there's nothing to filter, so the context conditions don't have any effect.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Thanks JD, completely agree.  Hiding the context property tab when no model is selected is the approach I took with the Collapsible Wrapper component (https://community.skuidify.com/skuid/topics/collapsible-wrapper-custom-component) I wrote recently.  It seems like the most appropriate behavior within the builder when context really isn't applicable.  Definitely a lower priority item but something that should be improved to avoid user confusion.  Thanks!