【问题标题】:Kendo UI Grid Hide Column.TemplateKendo UI Grid Hide Column.Template
【发布时间】:2013-01-15 03:05:26
【问题描述】:

我正在使用 Kendo UI 的组件,但在 Grid 中有问题

如果你使用下面的代码列“命令”没有显示在页面上,但是页面的Change Sort或者by grid,有一个页面刷新。

@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
    columns.Bound(p => p.cd_empresa).Visible(false);
    columns.Bound(p => p.cd_grupo).Visible(false);
    columns.Bound(p => p.descricao);
    columns.Template
    (
        @<text>
    Text 1
    Text 2

    </text>
    ).Title("Command").Width(80);

})
.ColumnMenu()
 .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
.Pageable()
.Sortable()
.Scrollable(scr => scr.Height(240))
.Filterable()
.DataSource(dataSource => dataSource
    .Ajax()
    .ServerOperation(false)
    .PageSize(7)
    .Read(read => read.Action("Index", "GrupoFiscal"))
    .Model(model => model.Id(p => p.cd_grupo))
    .Model(model => model.Id(p => p.cd_empresa))
)

)

如果我把

. DataSource (dataSource => dataSource
         . Ajax ()
         . ServerOperation (false)
         . PageSize (7)
         . Read (read => read.Action ("Index", "GrupoFiscal"))
         . Model (model => model.Id (p => p.cd_grupo))
         . Model (model => model.Id (p => p.cd_empresa))
     )

Ajax 无需刷新页面即可工作,但“命令”列不显示。 注意此列包含编辑、删除和详细信息的链接

【问题讨论】:

    标签: kendo-ui kendo-grid


    【解决方案1】:

    参考documentation:

    没有显示列模板

    如果设置了服务器模板但网格已设置,则会发生这种情况 配置为 ajax 绑定。设置 ClientTemplate 为好。这会 如果仅设置了客户端模板但网格设置了,也会发生 配置为服务器绑定。也设置模板。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-20
      • 2022-01-06
      • 2018-07-29
      • 2017-07-23
      • 1970-01-01
      相关资源
      最近更新 更多