簡體   English   中英

Kendo Grid - 如何在列菜單中設置不同的列標簽

[英]Kendo Grid - How to set different column label in column menu

看看這個小提琴

var _grid = $("#grid").kendoGrid({
   dataSource: _peopleDataSource,
   filterable: true,
   columnMenu: true,
   columns: [
    {
        field: "id",title: " ",width: 10
    },
    {
        field: "name",title: "Name",width: 40
    },{
        field: "roleTitle",title: "Role",width: 50
    }
   ],
   editable: true
}).data("kendoGrid");

Id的列沒有列標題。 但是,在網格列菜單中,我需要將列名顯示為Id

我在kendo文檔上找不到任何東西。 知道我怎么能做到這一點?

我建議將title字段設置為“Id”並使用空的headerTemplate

var _grid = $("#grid").kendoGrid({
    dataSource: _peopleDataSource,
    filterable: true,
    columnMenu: true,
    columns: [
        {
            field: "id",
            headerTemplate: "",
            title: "Id",
            width: 10
        },
        {
            field: "name",
            title: "Name",width: 40
        },{
            field: "roleTitle",
            title: "Role",width: 50
        }
    ],
    editable: true
}).data("kendoGrid");

這樣,列名稱不會顯示在標題中,但會列在列菜單中。

參見示例: http//jsfiddle.net/lhoeppner/74LvK/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM