I am trying make the an editable grid to uneditable depend on conditions.
I have tried in jquery as below
var $grid = &("#gridName").data("kendogrid");
Var model = $grid.datasource.at(1);
if(model)
model.field["cell"].editable = false;
but here the 'model' is getting undefined.
also tried $grid.data() and then looping through the grid, but the cells are not getting uneditable they are still editable.
Can anyone please let me know how can I make this work.
You have some typographic errors...
Try this instead:
var $grid = $("#gridName").data("kendoGrid");
var model = $grid.dataSource.at(1);
if (model)
model.fields["cell"].editable = false;
data
it is kendoGrid and not kendogrid.model
it is var and not Var
fields
and not field
EDIT: If you want to change "cell"
column to not editable, simply do:
var $grid = $("#gridName").data("kendoGrid");
$grid.dataSource.at(0).fields["cell"].editable = false;
You just need to change it to one row since the model is shared by all rows in the grid.
See it running in JSFiddle here http://jsfiddle.net/OnaBai/GuyPa/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With