SmartGWT: hide a column in a grouped grid (which makes the group)

帅比萌擦擦* 提交于 2019-12-02 14:46:19

问题


I have a SmartGWT grid, where I want to display some data from JBoss-Server and it's grouped by one textfield that I fetch from JSON.

So, but I want this textfield only in the header of each group.

When I do .hideField on this field, then i'm loosing the group.

grid.hideField("pool");

But when i hide it over the context-menue of the grid header, the column remains.

Any idea how to do this?

Roman.


回答1:


There is simple and clean workaround. Just set width parameter of the filed to '0'. Additionally clear title parameter if you have one (but this is only necessary in some sophisticated ListGrid use cases).




回答2:


I've actually had the most success hiding the field using the DataSourceField as opposed to the grid itself.

DataSource ds = new DataSource() {
    {
        DataSourceTextField field = new DataSourceTextField();
        field.setHidden(true);

        addField(field);
    }
}



回答3:


You've already posted here and didn't answer to the people who oriented you toward the setHidden methode of the ListGridField.




回答4:


The clean way is to hide the ListGridField like this:

    ListGridField groupField = new ListGridField(FLD_CATEGORY, "Group");
    groupField.setHidden(true);

Note that if you use a DataSourceField, you may need to declare hard-coded ListGridField definitions



来源:https://stackoverflow.com/questions/10834024/smartgwt-hide-a-column-in-a-grouped-grid-which-makes-the-group

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!