jeudi 25 janvier 2018

Why checkbox isn't work as expected with inline edit - Kendo Grid?

I've a Kendo Grid in my application, I use ClientTemplate for checkbox in a column. The checkbox isn't display when the page loads, but the property(CheckName) value is true, so it should be. Another thing is, when I click to the checkbox, and after that click on another, the previous checked checkbox dissapears. I use InCell edit, maybe it cause the problem? Any advice'd be helpful.

@(Html.Kendo().Grid<myViewModel>()
    .Name("mygrid")
    .Filterable()
    .Sortable()
    .Editable(e => e.Mode(GridEditMode.InCell))
    .Columns(columns =>
    {
        columns.Bound(c => c.Id).Visible(false);
        columns.Bound(c => c.CheckName).Title("Default/Active")
                .ClientTemplate("<input type='checkbox' #= IsActive ? checked='checked' : '' # onclick='setCheckName()' id='CheckNameid' />")

        columns.Bound(c => c.Name);
    })
    .DataSource(ds => ds
        .Ajax()
        .Read(r => r.Action("ReadData", "MyContr"))
        .Update(u => u.Action("UpdateData", "MyContr"))
        .AutoSync(true)
        .Model(model =>
        {
            model.Id(m => m.Id);
            model.Field(m => m.CheckName);
            model.Field(m => m.Name);
        })
    )
)




Aucun commentaire:

Enregistrer un commentaire