Make single column editable in kendo ui grid

671 views Asked by At

I have a kendo grid, in which I want to make a column editable.

Check the below code what I have done

 Html.Kendo().Grid(Model.MyGridData)
        .Name("MyGridName")
        .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Events(e => e.RequestEnd("FormatDates"))
                    .ServerOperation(true))
        .Columns(columns =>
            {
                foreach (var item in Model.GridHeaderCollection)
                {
                    if (item.IsEditable)
                    {
                        columns.Bound(item.Name)
                                .ClientTemplate("# if(" + item.Name + "){#<input id='checkbox' onclick='grdChkBoxClick(this); ' class='chkboxApprove' type='checkbox' checked='checked' value='#=" + item.Name + "#' chkValue='decline_#=" + item.Name + "#' />#}else{#<input id='checkbox' onclick='grdChkBoxClick(this); ' class='chkboxApprove' type='checkbox' value='#=" + item.Name + "#' chkValue='decline_#=" + item.Name + "#' />#}# ")
                                .Title(item.Name);
                    }
                    else
                    {
                        columns.Bound(item.Name).Title(item.DisplayName).Format(GridDataFormat);
                    }
                }
            }).Events(e => e.DataBound("AttachmentActionFlyOutBound"))

So when I check/ uncheck the checkbox it should reflect in the data source

As I checked Editable is available for the entire model. I need it for a single column. I have seen some post which uses schema, didn't get how to implement the same here

0

There are 0 answers