Editable(false) not working on some columns

1 Answer 4170 Views
Grid
John
Top achievements
Rank 1
John asked on 29 Dec 2018, 02:55 AM

Several fields are configured as not editable and working as designed except for:

- ReportCategoryDesc  (Text field)

- IsVisibleInMenu           (Boolean)

Any ideas why these 2 are still editable?

Thanks

 

 

@( Html.Kendo().Grid<ShelfLife.ViewModels.Telerik.ReportMaintenanceItemVM>()
        .Name("client")
        .Columns(columns =>
        {
            columns.Bound(c => c.ReportID).Width(70).Title("ID");
            columns.Bound(c => c.ReportTitle);
            columns.Bound(c => c.ReportDescription);
            columns.Bound(c => c.Categories.ReportCategoryDesc).Filterable(ftb => ftb.Multi(true).Search(true));
            columns.Bound(c => c.ReportOrder).Width(100).Title("Order");
            columns.Bound(c => c.TRDXFile);
            columns.Bound(c => c.IsVisibleInMenu).Width(130).ClientTemplate("<input type='checkbox' #= IsVisibleInMenu ? checked='checked' :'' # />");
            columns.Bound(c => c.Active).Width(120).ClientTemplate("<input type='checkbox' #= Active ? checked='checked' :'' # />"); ;
            columns.Command(command => command.Destroy()).Width(110);
        })
        .ToolBar(toolbar =>
        {
            toolbar.Create();
            toolbar.Save();
        })
        .HtmlAttributes(new { style = "height: 900px;" })
        .Editable(editable => editable.Mode(GridEditMode.InCell))
        .Filterable()
        .Pageable(pageable => pageable.PageSizes(new int[] { 10, 20, 50, 100, 999 }))
        .ColumnMenu()
        .Groupable()
        .Navigatable()
        .Sortable()
        .Scrollable(scr => scr.Height(900))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Batch(true)
            .PageSize(20)
            .ServerOperation(false)
            .Events(events => events.Error("error_handler"))
            //.Model(model => model.Id(p => p.ReportID))
            .Model(model => {
                model.Id(p => p.ReportID);
                model.Field(p => p.ReportID).Editable(false);
                model.Field(p => p.ReportCategoryID).Editable(false);
                model.Field(p => p.ReportCategoryDesc).Editable(false);
                model.Field(p => p.ReportDescription).Editable(false);
                model.Field(p => p.ReportOrder).Editable(false);
                model.Field(p => p.ReportTitle).Editable(false);
                model.Field(p => p.TRDXFile).Editable(false);
                model.Field(p => p.IsVisibleInMenu).Editable(false);
            })

        .Create("Filter_Multi_Editing_Create", "Telerik")
        .Read("Filter_Multi_Editing_Read", "Telerik")
        .Update("Filter_Multi_Editing_Update", "Telerik")
        .Destroy("Filter_Multi_Editing_Destroy", "Telerik")
        )
    )

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 31 Dec 2018, 11:55 AM
Hello John,

I have examined the code and noticed that ReportCategoryDesc is a nested field. Would you update the DataSource Model definition with the full name of the field and see how the behavior changes:

model.Field(p => p.Categories.ReportCategoryDesc).Editable(false);

As for the IsVisibleInMenu field - it seems that the value for it is displayed in a ClientTemplate. Try adding a disabled attribute to the checkbox template and it would not be editable:

columns.Bound(c => c.IsVisibleInMenu).Width(130).ClientTemplate("<input type='checkbox' #= IsVisibleInMenu ? checked='checked' :'' # disabled />");


Give the modifications a try and let me know how they work for you.


Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
John
Top achievements
Rank 1
commented on 31 Dec 2018, 06:04 PM

That did it.  Thank you very much.
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or