PDA

View Full Version : [FIXED] [RC1b]Table inside a DisclosurePanel causes the columns to misalign with data



mayhasina
20 Jun 2008, 11:40 PM
Example:


List<TableColumn> columns = new ArrayList<TableColumn>();

TableColumn col = new TableColumn("Company", 180);
col.setMinWidth(75);
col.setMaxWidth(300);
columns.add(col);

col = new TableColumn("Symbol", 75);
columns.add(col);

col = new TableColumn("Last", 75);
col.setMaxWidth(100);
col.setAlignment(HorizontalAlignment.RIGHT);
columns.add(col);

col = new TableColumn("Change", 75);
col.setAlignment(HorizontalAlignment.RIGHT);
columns.add(col);

col = new TableColumn("Last Updated", 100);
col.setAlignment(HorizontalAlignment.RIGHT);
columns.add(col);

TableColumnModel cm = new TableColumnModel(columns);

Table tbl = new Table(cm);
//tbl.setSelectionMode(SelectionMode.MULTI);
tbl.setHorizontalScroll(true);


for (int i = 0; i < 20; i++) {

Object[] values = new Object[5];
values[0] = "aha";
values[1] = i==0 ? "" : "aha";
values[2] = i==0 ? "" : "aha";
values[3] = i==0 ? "" : "aha";
values[4] = i==0 ? "" : "aha";

TableItem item = new TableItem(values);
tbl.add(item);
}

DisclosurePanel d = new DisclosurePanel("show");
d.add(tbl);
Sample output in the attached file.

Thanks!7651

gslender
21 Jun 2008, 2:59 AM
...just a thought, why not wrap the table in a GXT ContentPanel with collapsable enabled?

mayhasina
21 Jun 2008, 8:04 AM
I thought about that option. It's just that the interface looks too boxy with a number of tables inside ContentPanels on a single page.

gslender
21 Jun 2008, 2:33 PM
...also, make sure you are using the following doctype in your HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

darrellmeyer
22 Jun 2008, 6:48 AM
There was a requirement that the table needed to be "sized" to render properly. I have fixed this behavior in SVN. As a workaround, you can set a width:


Table tbl = new Table(cm);
tbl.setWidth(500);

mayhasina
22 Jun 2008, 12:19 PM
Hi Darrell,
FYI, the tbl.setWidth didn't help in this case.

I'm using RC1b.
Thanks!