PDA

View Full Version : TabPanel 100% height with TableLayout



weis
16 Dec 2009, 11:54 AM
How to make table cell with tabPanel with height 100% to take rest free space of table & prevent scroll in browser window


Viewport viewport = new Viewport();
RootPanel.get().add(viewport);
viewport.setScrollMode(Scroll.AUTO);

// 100% 100%
TableLayout layout = new TableLayout(1);
layout.setHeight("100%");
layout.setWidth("100%");
viewport.setLayout(layout);

TabPanel panel = new TabPanel();
TabItem item = new TabItem();

ArrayList<ColumnConfig> list = new ArrayList<ColumnConfig>();
for (int i = 0; i < 60; i++) {
ColumnConfig config = new ColumnConfig();
config.setHeader(Integer.toString(i));
list.add(config);
}
ColumnModel cm = new ColumnModel(list);

ListStore<BaseModelData> store = new ListStore<BaseModelData>();
for (int i = 0; i < 100; i++) {
store.add(new BaseModelData());
}

Grid<BaseModelData> grid = new Grid<BaseModelData>(store, cm);
item.add(grid);
panel.add(item);

viewport.add(new LabelField("label1"));
viewport.add(new LabelField("label2"));

TableData data = new TableData();
data.setHeight("100%");
data.setWidth("100%");
viewport.add(panel, data);
viewport.layout();Now I suppose layout fails because getOffsetHeight for TabPanel target element returns total table height, not rest of available.