Is there a way to make all fields read only based on a condition?

  • 1
  • Question
  • Updated 1 year ago
  • Answered
I need to create functionality similar to Salesforce Approvals where as when a record has a particular status then everything on the SKUID page should be read only.

At the moment the only way I can think to do this is to replicate all tables and field editor components as read only and then conditionaly display the Read Only or Edit version based on the status of the record. But wondering if there is some sort of global way to make everything read only or some slick way in javascript to loop through all the components and change them to Read Only mode if the Status is set to a particular value.

I have a ton of tabs on the page with lots of field editors and tables so hoping someone has a better solution than what I have come up with.
Photo of Joseph Ucuzoglu

Joseph Ucuzoglu

  • 1,074 Points 1k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Mordechai

Mordechai

  • 968 Points 500 badge 2x thumb
you can set the entire model to be read-only.
Photo of Chandra R

Chandra R

  • 300 Points 250 badge 2x thumb
Hi Mordechai, could you please elaborate on how to set the entire model to be read-only conditionally? Thanks!
Photo of Mordechai

Mordechai

  • 968 Points 500 badge 2x thumb
To be clear. a PAGE cannot be made read-only. you'd have to make each TABLE or field editor read-only.

depending on how many fields you have, a simple way to accomplish this is to add make all fields use a custom renderer that just says to use either the read or edit default renderer for that field, depending on your condition.
similar to:
skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode]( field, value );
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
This post might help. You could create this button, then conditionally render the button:. https://community.skuidify.com/skuid/...
Photo of Chandra R

Chandra R

  • 300 Points 250 badge 2x thumb
Hi Joseph, I am in the similar situation as you were 2 year ago. I would like to make the entire Skuid page read-only based on a field value. May I know how you achieved this? Thank you!