【问题标题】:How to hide a column in KoGrid如何在 KoGrid 中隐藏列
【发布时间】:2013-12-23 19:42:34
【问题描述】:

我已经开始使用 koGrid。我想在 koGrid 中隐藏一个特殊的列“id”。我该怎么做?

 gridOptions : {
        displaySelectionCheckbox: false,
        data: items,
        multiSelect: false, 
        enableColumnResize: true,                
        columnDefs: [
                      { field: 'id', displayName: 'id' },
                      { field: 'name', displayName: 'Name' }

        ]
    }

【问题讨论】:

    标签: javascript jquery knockout.js kogrid


    【解决方案1】:

    有一个visible option on the columnDefs可以设置为false

    columnDefs: [
        { field: 'id', displayName: 'id', visible: false },
        { field: 'name', displayName: 'Name' }
    ]
    

    或者,如果您在任何地方都不需要 id 值(因此您没有在模板中使用或过滤排序等),您可以省略整个 { field: 'id', displayName: 'id' }

    【讨论】:

    • 非常感谢。你节省了我的时间。
    猜你喜欢
    • 2013-08-10
    • 2021-05-08
    • 2014-12-16
    • 2022-06-22
    • 1970-01-01
    • 2011-06-24
    • 2018-03-25
    • 2015-12-19
    • 1970-01-01
    相关资源
    最近更新 更多