使用Vaadin 7.4.9从Grid获取propertyName的列号

时间:2017-08-20 08:46:17

标签: grid vaadin

我想从网格中获取列号。我怎么能得到它?

Grid grid = new Grid();
IndexedContainer container = new IndexedContainer();
grid.setContainerDataSource(container);
container.addContainerProperty("name", String.class, "");
container.addContainerProperty("surname", String.class, "");
container.addContainerProperty("age", Integer.class, 0);

我得到了解决方案:

List list = grid.getColumns();


for(int i = 0; i < list.size(); i++)
    System.out.println(list.get(i) + " is on position: " + i);

1 个答案:

答案 0 :(得分:2)

解决方案是:

List list = grid.getColumns();

for(int i = 0; i < list.size(); i++)
System.out.println(list.get(i) + " is on position: " + i);