Details
-
New Feature
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.4.17
-
None
-
None
Description
GridView fills the table by rows. Filling by columns is needed too.
Since it uses DataProvider's iterator and by nature of HTML tables, the data need to come in the order of row's cells,
the best approach I've found is to reorder the list appropriately.
private void recalculateList2() { int cols = this.getColumns(); // Column height. int colHeight = list.size() / cols; // Last items may not fit whole row. colHeight += ( (list.size() % cols) == 0 ? 0 : 1 ); list2 = new ArrayList<T>( list ); for ( int i = 0; i < list.size(); i++ ) { int newIndex = (i % colHeight) * cols + (i / colHeight); list2.set( newIndex, list.get(i) ); } }
Computing the right position in a custom Iterator might be even better - no need for an extra ArrayList.
Attachments
Issue Links
- is related to
-
WICKET-3327 Grid Veiw to support more generic Grids
- Open