Getting the number of visible columns in a ListGrid in SmartGWT?

你说的曾经没有我的故事 提交于 2019-12-12 01:24:18

问题


I'm trying to get the number of visible columns (ListGridField) in a ListGrid.

Is there an easy solution for that?


回答1:


Here's the solution using ListGrid.fieldIsVisible(String fieldName) method:

private int getNumVisibleColumns(ListGrid grid) {
    int count = 0;
    for (ListGridField field : grid.getFields()) {
        if (grid.fieldIsVisible(field.getName())) {
            count++;
        }
    }
    return count;
}



回答2:


you can loop through the columns in the ListGrid and call ListGridField.getHidden() to count which ones are visible or not.



来源:https://stackoverflow.com/questions/5787620/getting-the-number-of-visible-columns-in-a-listgrid-in-smartgwt

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