PDA

View Full Version : [CLOSED] Bug with rendering GXT Button inside table with TableItem.setWidget()



andrey
15 May 2008, 7:03 AM
This bug is occuring in GXT Beta2:

If you try the test code below, you will see that a GWT Button renders fine within a table cell but a GXT Button does not.


import com.extjs.gxt.ui.client.Style;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.extjs.gxt.ui.client.widget.table.RowSelectionModel;
import com.extjs.gxt.ui.client.widget.table.Table;
import com.extjs.gxt.ui.client.widget.table.TableColumn;
import com.extjs.gxt.ui.client.widget.table.TableColumnModel;
import com.extjs.gxt.ui.client.widget.table.TableItem;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class TestTableWidgetAlign implements EntryPoint {
public void onModuleLoad() {
Viewport viewport = new Viewport();
viewport.setLayout(new FlowLayout());

TableColumn[] columns = new TableColumn[1];
columns[0] = new TableColumn("Widget", 100);
columns[0].setAlignment(Style.HorizontalAlignment.CENTER);

TableColumnModel<TableColumn> columnModel = new TableColumnModel<TableColumn>(columns);

Table<RowSelectionModel> table = new Table<RowSelectionModel>(columnModel);

TableItem item1 = new TableItem(new Object[1]);
item1.setWidget(0, new com.google.gwt.user.client.ui.Button("GWT")); // NOTE: GWT Button - Renders fine within the table
table.add(item1);

TableItem item2 = new TableItem(new Object[1]);
item2.setWidget(0, new com.extjs.gxt.ui.client.widget.Button("GXT")); // NOTE: GXT Button - *DOES NOT* render within the table
table.add(item2);

viewport.add(table);
viewport.add(new com.extjs.gxt.ui.client.widget.Button("GXT2")); // This GXT Button renders fine outside of the table

viewport.layout(true);
RootPanel.get("slot1").add(viewport);
}
}

andrey
15 May 2008, 9:16 AM
I came across another thread where Darrell suggested setting "bulk render" to false. I tried this with the example above and it resolved the problem. Although this kind of behavior is clearly non-intuitive to the GXT user.


table.setBulkRender(false);

darrellmeyer
20 May 2008, 8:36 PM
A runtime exception will now be thrown if you add widgets and have bulk rendering enabled.

andrey
21 May 2008, 4:19 AM
Thanks Darrell. Some mention of the connection between the bulk reader mode and the setWidget method in the javadoc would be nice as well.