How to keep the Kendo grid default grouping from being removed

1.3k Views Asked by At

I have a grid which has default grouping by one of the columns e.g "Important". I allow grouping by other columns, but I want to lock my default grouping. So no one can remove this grouping.

I didn't find any property to achieve this. I tried using the DataBound event change class and removed the remove button of this column in the group header but later the Kendo script reverted this back to its original state.

@(Html.Kendo().Grid<Model>()
    .Name("Grid")
    .DataSource(ds => ds
        .Ajax()
        .PageSize(20)
        .ServerOperation(false)
        .Model(m => m
            .Id(z => z.Id))
        .Read(r => r.Action("myAction", "myController"))
        .Group(g=>g.AddDescending(c=>c.Important))
        )
    .Columns(c =>
    {
       c.Bound(d => d.Important)
            .Title("This is important")
            .Groupable(false)
            .Visible(true)
            .Hidden(true);

        c.Bound(d => d.otherColumn)
            .Title("otherColumn")
            .Groupable(true);

             ....
     }
     .Groupable()
     .Events(e=>e
        .Change("onChange")   
        .DataBound("dataBound")
      )
)
0

There are 0 best solutions below