Mark a table row as read only and remove the select box based on the value of a field

  • 1
  • Question
  • Updated 3 years ago
  • Answered
Based on the value of a field in a table I want to render a row either as read only with no select boxes or editable with select check boxes.

For example:

There is a check box field in each row of the table entitled "Is Active?" If "Is Active" is checked then the row should render editable with a select check box. If "Is Active" is not checked the row should load read only without a select check box.
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,006 Points 5k badge 2x thumb
Tami,


Here's one idea:


Add a custom renderer for your editable fields. Your snippet has access to the row so you can check whether the row "Is Active" and depending on the value set the field to Read or Edit. You can also add a dummy class to one of the ancestor elements (using jQuery). You can use this class along with Skuid standard CSS to conditionally hide the select check box by row.


Make sense?


Regards,

Irvin
(Edited)
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
Another idea is to click on the standard "edit" row action and just add a condition under Rendering where it only renders if the record is active. This will get rid of the edit icon but you will still have to use Javascript to hide the select checkbox. 
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,006 Points 5k badge 2x thumb
Brilliant
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
Thanks!
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb
I second that, Brilliant!!
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb
Thanks for the ideas! I have not tested them yet but I think the issue I will run into is if I set a condition under rendering to only render if the record is active than I will not see the none active records. See I need to see the records that are active and not active. With the active being editable and the non active being read only. 
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
What Anna is suggesting is that you show all records,  add an "edit rows"  row action, and conditionally render that button so it only shows if you active flag is set for the record.  The rendering is evaluted row by row. 

Then you can use Irvin's idea to change the other rows to "Read Only"