2

我有一个网格,它按列之一进行默认分组,例如“重要”。我允许按其他列分组,但我想锁定我的默认分组。所以没有人可以删除这个分组。

我没有找到任何属性来实现这一点。我尝试使用 DataBound 事件更改类并删除了组标题中此列的删除按钮,但后来 Kendo 脚本将其恢复为原始状态。

@(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")
      )
)
4

0 回答 0