What steps will reproduce the problem?
1.
2.
3.
What is the expected output? What do you see instead?
after grid reconfigure with new columns, gwtextux summary plugin also
should be reconfigure
but not appear summary row.
is there any way to do this?
What version of the product are you using? On what operating system?
gwtextux 0.3
Please provide any additional information below.
here is my code
Panel panel = new Panel();
panel.setBorder(false);
panel.setPaddings(15);
final GridPanel grid = new GridPanel();
Object[][] data =new Object[][]{};
MemoryProxy proxy = new MemoryProxy(data);
ArrayReader reader = new ArrayReader(new RecordDef(new
FieldDef[]{}));
Store store = new Store(proxy, reader);
store.load();
grid.setStore(store);
BaseColumnConfig[] columns = new BaseColumnConfig[]{};
ColumnModel columnModel = new ColumnModel(columns);
grid.setColumnModel(columnModel);
summaryPlugin = new GridSummaryPlugin();
grid.addPlugin(summaryPlugin);
grid.setFrame(true);
grid.setStripeRows(true);
grid.setHeight(350);
grid.setWidth(400);
grid.setTitle("Grid with Summary Footer");
Toolbar topToolbar = new Toolbar();
topToolbar.addButton(new ToolbarButton("Toggle Summary", new
ButtonListenerAdapter() {
public void onClick(Button button, EventObject e) {
RecordDef recordDef = new RecordDef(
new FieldDef[]{
new StringFieldDef("company"),
new FloatFieldDef("price"),
new FloatFieldDef("change"),
new FloatFieldDef("pctChange"),
new DateFieldDef("lastChanged", "n/j h:ia"),
new StringFieldDef("symbol"),
new StringFieldDef("industry")
});
MemoryProxy proxy = new MemoryProxy(getCompanyData());
ArrayReader reader = new ArrayReader(recordDef);
Store store = new Store(proxy, reader);
store.load();
BaseColumnConfig[] columnsnew = new
BaseColumnConfig[]{
new SummaryColumnConfig(
SummaryColumnConfig.COUNT,
new ColumnConfig("Company",
"company", 200, true, null, "Company"),
new Renderer() { // summary
renderer
public
String render(Object value, CellMetadata cellMetadata, Record record,
int rowIndex, int colNum, Store store) {
if(value != null) {
int intValue = ((Integer)value).intValue();
if(intValue == 0 || intValue > 0) {
return "(" + intValue + " Companies)";
} else {
return "(1 Company)";
}
}
else {
return "";
}
}
}
),
new SummaryColumnConfig(
SummaryColumnConfig.SUM,
new ColumnConfig("Price", "price",
75) {
{
setEditor(new
GridEditor(new NumberField() {
{
setAllowDecimals(true);
}
}));
}
}
),
new SummaryColumnConfig(
SummaryColumnConfig.AVERAGE,
new ColumnConfig("Change",
"change", 100),
new Renderer() { // summary
renderer
public
String render(Object value, CellMetadata cellMetadata, Record record,
int rowIndex, int colNum, Store store) {
return value == null ? "" : ("Average: " +
((Float)value).floatValue());
}
}
),
new ColumnConfig("% Change", "pctChange", 75)
};
ColumnModel columnModelnw =new
ColumnModel(columnsnew);
grid.reconfigure(store, columnModelnw);
grid.doLayout();
}
}));
topToolbar.addFill();
grid.setTopToolbar(topToolbar);
GridView gv=new GridView();
grid.setView(gv);
panel.add(grid);
RootPanel.get().add(panel);
}
private Object[][] getCompanyData() {
return new Object[][]{
new Object[]{"3m Co", new Double(71.72), new Double(0.02),
new Double(0.03), "9/1 12:00am", "MMM",
"Manufacturing"},
new Object[]{"Alcoa Inc", new Double(29.01), new
Double(0.42),
new Double(1.47), "9/1 12:00am", "AA",
"Manufacturing"},
new Object[]{"Altria Group Inc", new Double(83.81), new
Double(0.28),
new Double(0.34), "9/1 12:00am", "MO",
"Manufacturing"},
new Object[]{"American Express Company", new Double(52.55),
new Double(0.01),
new Double(0.02), "9/1 12:00am", "AXP", "Finance"},
new Object[]{"American International Group, Inc.", new
Double(64.13), new Double(0.31),
new Double(0.49), "9/1 12:00am", "AIG",
"Services"},
new Object[]{"AT&T Inc.", new Double(31.61), new Double(-
0.48),
new Double(-1.54), "9/1 12:00am", "T", "Services"},
new Object[]{"Boeing Co.", new Double(75.43), new
Double(0.53),
new Double(0.71), "9/1 12:00am", "BA",
"Manufacturing"},
new Object[]{"Caterpillar Inc.", new Double(67.27), new
Double(0.92),
new Double(1.39), "9/1 12:00am", "CAT",
"Services"},
new Object[]{"Citigroup, Inc.", new Double(49.37), new
Double(0.02),
new Double(0.04), "9/1 12:00am", "C", "Finance"},
new Object[]{"E.I. du Pont de Nemours and Company", new
Double(40.48), new Double(0.51),
new Double(1.28), "9/1 12:00am", "DD",
"Manufacturing"}
};
}
Original issue reported on code.google.com by bhaddh...@gmail.com on 22 Sep 2009 at 3:46
Original issue reported on code.google.com by
bhaddh...@gmail.com
on 22 Sep 2009 at 3:46