Conditional Rendering "Component Mode" & "Field Editability" condition

  • 5
  • Idea
  • Updated 3 years ago
  • Under Consideration
Merged

This conversation has been merged. Please reference the main conversation: conditional mode for component and field

Would like to see the following enhancements to conditional rendering:

1) Ability to write a conditional rendering rule based on the "mode" of the component (e.g. edit, read, readonly)

2) Ability to write a conditional rendering rule based on the "editability" of the field (e.g. field.editable)

This would go a long way towards being able to make components that support view/edit/new simultaneously.

In the past, there was discussion of adding a "call snippet" feature to conditional rendering.  This would allow a conditional rendering rule to be written in anyway that one could imagine.  The snippet would return true/false and could even not allow promises (to avoid long waiting async calls).  Having this added would be my personal nirvana :)

Thanks!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb

Posted 3 years ago

  • 5
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Component Mode and Field Editability would very much make sense.

The Call Snippet feature has been prototyped but the holdup right now is determining what triggers the re-evaluation of the Snippet. We could easily have the "basic" use case work, where the Snippet is only evaluated when the component is rendered, but we'd like to make it possible for the Snippet to be re-evaluated when appropriate, which is not at all obvious for a generic snippet. We've considered off-loading this to the Snippet, requiring the snippet to return a more complex metadata object defining when it should be re-evaluated, or allowing for some configuration in the Page Composer of certain Model / Component events that would initiate a re-evaluation of the Snippet. 
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Thanks Zach.  For what its worth here's my thoughts:

1) If I'm understanding correctly, I think the "basic" approach wouldn't add much value.  You'd get one crack at giving an "answer" and then its true or false from there on out.  

2) Having the snippet return metadata in some way would work.  It could return an object { answer: true, [ { model: m, row: r, fields: ['myfield__c', 'yourfield__c']]} that could be registered for event subscription and force a re-evaluation of the snippet.  

3) The snippet could be on its own for subscribing to events and then there could be a callback to skuid that tells skuid - hey, I changed, re-render anyone that cares about me.  It would be a kin to the way skuid currently detects when conditional rendering needs to be re-evaluated, just a new source of where those notifications come from.

4) Page Composer properties - This one seems the cleanest to me and likely would work best.  In the composer, have a properties tab with a set of options similar to the current conditional rendering options.  However, instead of using that set of data for conditional rendering itself, it would be a multi-pick that page developer could add and then skuid would treat those just like it does if it was a normal condtiional rendering rule, sinking events, evaluating and firing as necessary.

Thanks!

This conversation is no longer open for comments or replies.