Hello there.
So what I'm trying to do is to disable/enable grid editing from Javascript. Here's the code done with MVC:
@(Html.Kendo().Grid<DocumentGoodsReceiptFuel>()
.Name("fuelGrid")
.Columns(columns =>
{
columns.Bound(c => c.MaterialString).Title("Material").Width(150);
columns.Bound(c => c.QuantityOrdered).Title("Quantity dispatched").Width(150);
columns.Bound(c => c.QuantityUnloaded).Title("Quantity unloaded").Width(150);
})
.Scrollable(a => a.Height("auto"))
.Filterable(filterable => filterable.Enabled(true))
.Pageable(pager => pager.Refresh(false))
.Sortable(sortable => sortable.Enabled(true)).AutoBind(false)
.Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple))
.AllowCopy(true)
.Editable(editable => editable.Mode(GridEditMode.InCell))
.DataSource(dataSource => dataSource.Ajax().ServerOperation(false).Batch(false).PageSize(100)
.Model(model =>
{
model.Id(gridMainAlias => gridMainAlias.ID);
model.Field(gridMainAlias => gridMainAlias.MaterialString).Editable(false);
model.Field(gridMainAlias => gridMainAlias.QuantityOrdered).Editable(true);
model.Field(gridMainAlias => gridMainAlias.QuantityUnloaded).Editable(true);
}))
.Resizable(resize => resize.Columns(true))
.Mobile(MobileMode.Auto)
)
I'd like to disable and enable the last two columns (or entire grid, both goes) from Javascript dynamically/on demand.
I've tried this: $('#fuelGrid').data('kendoGrid').dataSource.options.schema.model.fields["QuantityUnloaded"].editable =false
but it doesn't work, it just sets the editable false for that column but it doesn't refresh the settings or something, so the change is not applied on the grid. What do you recommend in this scenario? Thanks in advance!