我想从网格中获取列号。我怎么能得到它?
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);
答案 0 :(得分:2)
解决方案是:
List list = grid.getColumns();
for(int i = 0; i < list.size(); i++)
System.out.println(list.get(i) + " is on position: " + i);