This is a migrated thread and some comments may be shown as answers.

InLine Editable Grid with Dynamically Visible Checkboxes in Cells

2 Answers 556 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 15 Apr 2020, 03:08 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Georgi
Telerik team
answered on 17 Apr 2020, 07:37 AM

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.
0
Chris
Top achievements
Rank 1
answered on 17 Apr 2020, 01:46 PM
Thank Georgi, that works great.
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Chris
Top achievements
Rank 1
Share this question
or