如何根据某些运行时参数隐藏 dgrid (gridFromHtml) 中的完整列?
假设参数的值为真,我应该能够显示一些列,如果值为假,那么我应该能够隐藏同一列。
最佳答案
使用 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;");
关于dojo - 动态隐藏 dgrid 中的列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10650640/