[英]enhancement for gwt-ext
Commonly, I create default GridPanel like new GridPanel(xxx, 480, 200, 1, 5) and I can control which column should be hidden through the first parameter in the constructor of gridpanel. 通常,我创建像新的GridPanel(xxx,480,200,1,5)这样的默认GridPanel,并且可以通过gridpanel构造函数中的第一个参数控制应隐藏哪一列。
For example, I create a gridpanel like below and I want to hide the column called description . 例如,我创建一个如下所示的网格面板,并且想要隐藏名为description的列。
public static xxx[] grdFundOutputs = {
new xxx("ID", "id", Integer.class, 50),
new xxx("Name", "name", String.class, 100),
new xxx("Description", "description", String.class, 150,true),//true represent hidden
new xxx("Amount", "amount", Float.class, 70),
};
public static GridPanel createGrid(){
return new GridPanel(grdFundOutputs, 480, 200, 1, 5);
}
note :I used xxx to indicate the classname, because I cannot expose it to the public due to the extension for the gwt-ext by my company. 注意 :我使用xxx表示类名,因为由于公司对gwt-ext的扩展,我无法将其公开。
My requirement is that I didn't hope user can manually make the hidden column re-shown by clicking the checkbox like following action in image. 我的要求是,我不希望用户可以通过单击复选框(如图像中的以下操作)来手动使隐藏的栏重新显示。
How can I implement this requirement, because of gwt-ext , I think it's hard for me to change the manner of ext-js.I hope to add a function to the class GridPanel so that developer can invoke it to let the checkbox hidden. 由于gwt-ext的原因,我该如何实现这一要求,我觉得很难改变ext-js的方式。我希望在GridPanel类中添加一个函数,以便开发人员可以调用它以隐藏复选框。
Thanks. 谢谢。
I can add this method to my own code and invoke it before gridpanel's construction 我可以将此方法添加到我自己的代码中,然后在构建gridpanel之前调用它
private native void unableHiddenReShown()/*-{
$wnd.Ext.override($wnd.Ext.grid.GridView, {
beforeColMenuShow : function(){
var cm = this.cm, colCount = cm.getColumnCount();
this.colMenu.removeAll();
for(var i = 0; i < colCount; i++){
if(cm.config[i].fixed !== true && cm.config[i].hideable !== false && !cm.isHidden(i) //!cm.isHidden(i) was added to solve this problem){
this.colMenu.add(new $wnd.Ext.menu.CheckItem({
id: "col-"+cm.getColumnId(i),
text: cm.getColumnHeader(i),
checked: !cm.isHidden(i),
hideOnClick:false,
disabled: cm.config[i].hideable === false
}));
}
}
}
});
}-*/;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.