José Luiz
José Luiz

Reputation: 333

Kendo UI Grid Hide Column.Template

The components I'm using Kendo UI, but I have problem in Grid

If you use the code below the column "Command" does not show on the page, but the page Change Sort or by grid, there is a page refresh.

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

)

If I put     

. 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 works without refresh the page, but the column "Command" no shows. Note This column has links to Edit, Delete and Details

Upvotes: 1

Views: 4360

Answers (1)

Atanas Korchev
Atanas Korchev

Reputation: 30661

Refer to the documentation:

A column template is not displayed

This will happen if the server template is set but the grid is configured for ajax binding. Set the ClientTemplate as well. This will also happen if only the client template is set but the grid is configured for server binding. Set the Template as well.

Upvotes: 3

Related Questions