如何根据一些运行时参数隐藏dgrid(gridFromHtml)中的完整列?让我们说如果参数的值为true我应该能够显示一些列,如果值为false,那么我应该能够隐藏同一列.
phu*_*ick 15
用途grid.styleColumn(columnId, css):
var grid = new Grid({
store: store,
columns: [
{ id: "artist", label: "Artist", field: "Artist"},
{ id: "name", label: "Song", field: "Name"},
{ id: "gerne", label: "Genre", field: "Genre"}
]
}, "grid-placeholder");
// to hide column with id="name"
grid.styleColumn("name", "display: none;");
// to show it
grid.styleColumn("name", "display: table-cell;");
Run Code Online (Sandbox Code Playgroud)
小智 6
有一个名为ColumnHider的dgrid扩展,它允许您传入一个带有"hidden"属性的列.
require([
"dojo/_base/declare", "dgrid/OnDemandGrid", "dgrid/extensions/ColumnHider"
], function(declare, OnDemandGrid, ColumnHider) {
var grid = new(declare([OnDemandGrid, ColumnHider]))({
columns: {
col1: {
label: "Column 1",
hidden: true
},
col2: {
label: "Column 2",
unhidable: true
},
col3: "Column 3"
}
}, "grid");
// ...
});Run Code Online (Sandbox Code Playgroud)
这也将使用户能够隐藏自己的列.您可以将某些列设置为不可识别,如上面的第2列
| 归档时间: |
|
| 查看次数: |
8475 次 |
| 最近记录: |