[英]how to hide column of GridPanel in extjs
hi i have gridcoumn with multiple columns ,i want hide and show some column with AriaAttributes() when change my combobox(this code is ok just not work hide and show columns) my code:嗨,我有多个列的 gridcoumn,我想在更改组合框时使用 AriaAttributes() 隐藏并显示一些列(此代码可以,只是无法隐藏和显示列)我的代码:
@(X.GridPanel()
.View(X.GridView().GetRowClass(x => x.Fn = "MyRowCls"))
.Stateful(true)
.Region(Region.Center)
.ID("MyGrid")
X.Column().Text("a").DataIndex(Model, m => m.a),
X.Column().Text("b").DataIndex(Model, m => m.b).AriaAttributes(myAttr),//show and hide this column
X.Column().Text("c").DataIndex(Model, m => m.b),
X.Column().Text("c").DataIndex(Model, m => m.b),
X.Column().Text("c").DataIndex(Model, m => m.b).AriaAttributes(myAttr),//show and hide this column
X.Column().Text("a").DataIndex(Model, m => m.a)
...
and jquery code is :和 jquery 代码是:
var grid = Ext.getCmp('MyGrid');
grid.initialConfig.columns.items.forEach(
... /checked AriaAttributes is ok
{
item.Hidden(true); // not work
//item.setVisible(false) // not work
.... // not work
}
...
}
but not work但不工作
You are trying to call setVisible
a method on a simple object, because initialConfig.columns
stores the original configs of columns that did not pass the conversion to gridcolumns
instance.您正在尝试对简单对象调用
setVisible
方法,因为initialConfig.columns
存储未将转换传递给gridcolumns
实例的列的原始配置。
The columns themselves are here - grid.columns
and it has needed methods列本身在这里 -
grid.columns
并且它需要方法
var grid = Ext.getCmp('MyGrid');
grid.columns.items.forEach(item =>
...
{
item.setVisible(false);
// or you can call hide() method
}
...
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.