InLine Editable Grid with Dynamically Visible Checkboxes in Cells

3 posts, 1 answers
  1. Chris
    Chris avatar
    2 posts
    Member since:
    Oct 2013

    Posted 15 Apr 2020 Link to this post

    Hi,

    we have a InLine editable grid that has several columns that may or not require a checkbox in them based on a flag in the model used for the grid.

    The combination of which checkboxes are available varies from row to row (see attached image). For any cells that have a checkbox, this should be editable when you go into the edit mode for the row.

    I have managed to get this to display properly using a client template when viewing the grid using the code:

    .ClientTemplate("<div style='text-align:center'># if(data.PrivateCircuitExpected) {# <input type='checkbox' disabled='disabled' #= data.PrivateCircuit ? checked='checked' :'' #></input> #}#</div>")

     

     

    In the case of this column data.PrivateCircuitExpected defines whether this row should have a checkbox. data.PrivateCircuit is whether this value is ticked or not.

    The one issue I'm having is that checkboxes appear in all columns when you go into the edit mode for the row as in attached image.

    What would be the best approach to allow checkboxes to be hidden in edit mode if, in this case, data.PrivateCircuitExpected is false?

    Thank you

  2. Answer
    Georgi
    Admin
    Georgi avatar
    685 posts

    Posted 17 Apr 2020 Link to this post

    Hi Chris,

    You could use the Column.Editable configuration to disable editing for certain columns.

    e.g.

    // column
    
    columns.Bound(o => o.FieldName).Editable("handler");
    
    // handler
    
    function handler(item){
       return item.PrivateCircuitExpected;
    }

    Regards,
    Georgi
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
  3. Chris
    Chris avatar
    2 posts
    Member since:
    Oct 2013

    Posted 17 Apr 2020 in reply to Georgi Link to this post

    Thank Georgi, that works great.
Back to Top