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

edited June 29, 2020 in Questions
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.

Comments

  • edited May 8, 2019
    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
  • Anna WiersemaAnna Wiersema 🛠️ 
    edited June 29, 2020
    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. 
  • edited December 15, 2016
    Brilliant
  • Anna WiersemaAnna Wiersema 🛠️ 
    edited November 23, 2015
    Thanks!
  • edited December 2, 2016
    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. 
  • Rob HatchRob Hatch 💎💎💎
    edited September 1, 2016
    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" 
  • edited December 2, 2016
    I second that, Brilliant!!
  • Mark LMark L ✭✭✭✭
    edited November 7, 2019
    I don't follow how this works. How are you referring to row context to get the value of a field in a specific row here? It seems not possible to refer to row context to get a field value, the only thing you can read it seems is "row property" in a render condition on a row. Also, even if the edit button is hidden to try and prevent you from editing a row, it's still possible to double click on a field in a row to edit it. The table would need to be read only and the edit button be a custom popup editor, but still I don't see how you are referring to a field value via row context in the render conditions on the button; every way I try to set this up it doesn't work and there is no "row field value" as an option to choose from.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!