-
26 Apr 2012 6:37 AM #1
Grid row with a CheckBoxCell has wrong height
Grid row with a CheckBoxCell has wrong height
The row's height is higher than usual.
gridtest2.jpgCode:package es.inaer.taller.client; import java.util.ArrayList; import com.google.gwt.cell.client.TextCell; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.ui.RootPanel; import com.sencha.gxt.cell.core.client.form.CheckBoxCell; import com.sencha.gxt.core.client.ValueProvider; import com.sencha.gxt.data.shared.ListStore; import com.sencha.gxt.data.shared.ModelKeyProvider; import com.sencha.gxt.widget.core.client.button.TextButton; import com.sencha.gxt.widget.core.client.container.FlowLayoutContainer; import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; import com.sencha.gxt.widget.core.client.grid.ColumnConfig; import com.sencha.gxt.widget.core.client.grid.ColumnModel; import com.sencha.gxt.widget.core.client.grid.Grid; public class Test implements EntryPoint { private int newId = -1; public class Cat { private String id; private String name; private Boolean hasOwner; public Cat(String id, String name) { this.id = id; this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Boolean getHasOwner() { return hasOwner; } public void setHasOwner(Boolean hasOwner) { this.hasOwner = hasOwner; } } public void onModuleLoad() { ArrayList<ColumnConfig<Cat, ?>> colConfigs = new ArrayList<ColumnConfig<Cat, ?>>(); ColumnConfig<Cat, String> nameCol = new ColumnConfig<Cat, String>(new ValueProvider<Cat, String>(){ @Override public String getValue(Cat object) { return object.getName(); } @Override public void setValue(Cat object, String value) { object.setName(value); } @Override public String getPath() { return "name"; }}, 30, "Name"); // Height of a new row on Grid is wrong when adding a new element without text if a custom Cell is configured. // Commenting this line height of the new row is right nameCol.setCell(new TextCell()); colConfigs.add(nameCol); ColumnConfig<Cat, Boolean> hasOwnerCol = new ColumnConfig<Cat, Boolean>( new ValueProvider<Cat, Boolean>(){ @Override public Boolean getValue(Cat object) { return object.getHasOwner(); } @Override public void setValue(Cat object, Boolean value) { object.setHasOwner(value); } @Override public String getPath() { return "hasOwner"; }}, 20, "Has owner"); hasOwnerCol.setCell(new CheckBoxCell()); colConfigs.add(hasOwnerCol); ColumnModel<Cat> columModel = new ColumnModel<Cat>(colConfigs); final ListStore<Cat> catStore = new ListStore<Cat>(new ModelKeyProvider<Cat>() { @Override public String getKey(Cat item) { return item.getId(); }}); final Grid<Cat> grid = new Grid<Cat>(catStore, columModel); grid.getView().setForceFit(true); grid.setWidth(300); grid.setHeight(400); grid.setBorders(true); TextButton b = new TextButton("Add"); b.addSelectHandler(new SelectHandler() { @Override public void onSelect(SelectEvent event) { catStore.add(new Cat("" + newId--, "")); } }); FlowLayoutContainer flc = new FlowLayoutContainer(); flc.add(grid); flc.add(b); RootPanel.get().add(flc); } }
-
13 Jun 2012 11:51 PM #2
Anything new on this? I am having the same problem.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote