PDA

View Full Version : [FIXED] First row doesn't expand correctly with RowExpander



stegro
18 Jul 2008, 2:29 PM
The patch below fixes the rendering of the expanded first row with Grids using RowExpander. Attached image shows before/after behaviour.

Stephen


Index: user/src/com/extjs/gxt/ui/client/widget/grid/GridView.java
===================================================================
--- user/src/com/extjs/gxt/ui/client/widget/grid/GridView.java (revision 611)
+++ user/src/com/extjs/gxt/ui/client/widget/grid/GridView.java (working copy)
@@ -580,12 +580,11 @@

for (int i = 0; i < colCount; i++) {
ColumnData c = cs.get(i);
+ String rv = getRenderedValue(c, j, i, r, c.id);
String css = i == 0 ? "x-grid-cell-first " : (i == last ? "x-grid3-cell-last " : " ");
String attr = c.cellAttr != null ? c.cellAttr : "";
String cellAttr = c.cellAttr != null ? c.cellAttr : "";
- cb.append(templates.cell(c.id, css, attr, cellAttr, c.style, getRenderedValue(c, j, i, r,
- c.id)));
-
+ cb.append(templates.cell(c.id, css, attr, cellAttr, c.style, rv));
}

String alt = "";

darrellmeyer
21 Jul 2008, 6:29 AM
Fix is in SVN.

z013908
12 Jan 2009, 4:52 AM
Hi,
I follow on this post because I've a similar problem when I add a CheckBoxSelectionModel on the grid with the checkbox on the first column.

If I add the CheckBoxSelectionModel.getColumn() on the 1st column, the rendering of the 2nd row is bad like in the image attachment.
If I add after the 1st column, there is no problem.

Some ideas?
Thanks

sven
12 Jan 2009, 5:02 AM
Post a simple testcase please.

z013908
12 Jan 2009, 6:22 AM
Hi,
here is a sample test.


package presentation.accueil.client;

import java.util.ArrayList;
import java.util.List;

import com.extjs.gxt.ui.client.core.XTemplate;
import com.extjs.gxt.ui.client.data.BaseModel;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.grid.CheckBoxSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.RowExpander;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.RootPanel;

public class BUG950GXT implements EntryPoint {

public class GridContainer extends LayoutContainer {

@Override
protected void onRender(Element parent, int index) {

super.onRender(parent, index);

List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

CheckBoxSelectionModel<Model> sm = new CheckBoxSelectionModel<Model>();
configs.add(sm.getColumn());

XTemplate tpl = XTemplate.create("<p>{details}</p>");
RowExpander expander = new RowExpander();
expander.setTemplate(tpl);
configs.add(expander);

ColumnConfig column = new ColumnConfig();
column.setId("id");
column.setHeader("ID");
column.setWidth(100);
configs.add(column);

column = new ColumnConfig();
column.setId("name");
column.setHeader("Name");
column.setWidth(300);
configs.add(column);

ListStore<Model> store = new ListStore<Model>();
store.add(new Model());

ColumnModel cm = new ColumnModel(configs);

Grid<Model> grid = new Grid<Model>(store, cm);
grid.setSelectionModel(sm);
grid.setBorders(true);
grid.addPlugin(expander);
grid.addPlugin(sm);

ContentPanel cp = new ContentPanel();
cp.setHeading("BUG950GXT");
cp.setLayout(new FitLayout());
cp.setSize(500, 300);
cp.add(grid);

add(cp);

}
}

public void onModuleLoad() {

Viewport vp = new Viewport();
vp.add(new GridContainer());

RootPanel.get().add(vp);
}

public class Model extends BaseModel {
public Model() {
set("id", "RFXGKSP");
set("name", "test");
set("details", "complementary information");
}
}

}
The checkboxselection is the 1st column, then the rendering of the 2nd part of the row is wrong.
If you move the
configs.add(sm.getColumn()); after column "name", it works.

I forgot : gwt 1.5.3 et gxt 1.2.1.

sven
21 Jan 2009, 1:43 PM
Fixed in SVN.

z013908
29 Jan 2009, 1:33 AM
Ok in gxt 1.2.2
Thanks !