chemkb
22 Oct 2011, 1:45 PM
I have crated multiple Grids from a single GroupingStore. Grids have GroupSummaryView as view. I want to use RowEditor plugin but having some issues implementing it. Below how you can reproduce my issue:
Goto: http://compressor-calculations.appspot.com/
1. add a row using the add item button on tool bar, once all the fileds are filled with valid input click save. it will save the values to the grid and row editor will exit.
2. Click save button at the bottom of the panel again to commit to the store.
2. Now add another row using the add item button on tool bar, once all the fileds are filled with valid input click save but this time values will be not saved and editor will not exit.
Below is the excerpt of my code.
public class LineItemGrid<BaseModel> extends LayoutContainer {
final GroupingStore<LineItemModel> store = new GroupingStore<LineItemModel>();
public LineItemGrid() {
setLayout(new FlowLayout(5));
store.groupBy("section");
final RowEditor<LineItemModel> re = new RowEditor<LineItemModel>();
final Grid<LineItemModel> gridGen = new Grid<LineItemModel>(store, getColumnModelGen());
GroupSummaryView summary = new GroupSummaryView();
summary.setForceFit(true);
summary.setShowGroupedColumn(true);
summary.setSortingEnabled(false);
summary.setGroupRenderer(new GridGroupRenderer() {
public String render(GroupColumnData data) {
return "Section " + data.group;
}
});
gridGen.setView(summary);
gridGen.getView().setShowDirtyCells(true);
//gridGen.getView().setShowInvalidCells(true);
gridGen.setAutoExpandColumn("volume");
gridGen.setBorders(true);
gridGen.setStripeRows(true);
gridGen.setColumnLines(true);
gridGen.setLoadMask(true);
gridGen.addPlugin(re);
final ColumnModel cmVol = new ColumnModel(getcolumnConfigVolume());
final EditorGrid<LineItemModel> gridVolume = new EditorGrid<LineItemModel>(store, cmVol);
final ColumnModel cmCalc = new ColumnModel(getcolumnConfigCalc());
final EditorGrid<LineItemModel> gridCalculation = new EditorGrid<LineItemModel>(store, cmCalc);
ContentPanel cp = new ContentPanel();
cp.setIcon(Resources.ICONS.table());
cp.setHeading("Compressor Settel Out Calculation v1.0 Beta");
cp.setFrame(true);
cp.setSize(990, 400);
cp.setLayout(new FitLayout());
cp.setHeaderVisible(false);
cp.add(gridGen);
ToolBar toolBar = new ToolBar();
Button add = new Button("Add Item");
add.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
LineItemModel item = new LineItemModel();
item.setVolume(0.0);
item.setInventory(0.0);
item.setNormalVolumn(0.0);
item.setMoles(0.0);
item.setMolesT(0.0)
//gridGen.stopEditing();
//store.insert(item, store.getCount());
//gridGen.startEditing(store.indexOf(item), 0);
re.stopEditing(true);
store.insert(item, store.getCount());
re.startEditing(store.indexOf(item), true);
gridGen.repaint();
}
});
Error: (:|
16:28:28.327 [ERROR] [settleoutcalcsext] Uncaught exception escaped
com.google.gwt.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
at com.google.gwt.user.client.Event$NativePreviewEvent.fire(Event.java:87)
at com.google.gwt.user.client.Event$NativePreviewEvent.access$4(Event.java:73)
at com.google.gwt.user.client.Event$.fireNativePreviewEvent(Event.java:488)
at com.google.gwt.user.client.DOM.previewEvent(DOM.java:1328)
at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
Goto: http://compressor-calculations.appspot.com/
1. add a row using the add item button on tool bar, once all the fileds are filled with valid input click save. it will save the values to the grid and row editor will exit.
2. Click save button at the bottom of the panel again to commit to the store.
2. Now add another row using the add item button on tool bar, once all the fileds are filled with valid input click save but this time values will be not saved and editor will not exit.
Below is the excerpt of my code.
public class LineItemGrid<BaseModel> extends LayoutContainer {
final GroupingStore<LineItemModel> store = new GroupingStore<LineItemModel>();
public LineItemGrid() {
setLayout(new FlowLayout(5));
store.groupBy("section");
final RowEditor<LineItemModel> re = new RowEditor<LineItemModel>();
final Grid<LineItemModel> gridGen = new Grid<LineItemModel>(store, getColumnModelGen());
GroupSummaryView summary = new GroupSummaryView();
summary.setForceFit(true);
summary.setShowGroupedColumn(true);
summary.setSortingEnabled(false);
summary.setGroupRenderer(new GridGroupRenderer() {
public String render(GroupColumnData data) {
return "Section " + data.group;
}
});
gridGen.setView(summary);
gridGen.getView().setShowDirtyCells(true);
//gridGen.getView().setShowInvalidCells(true);
gridGen.setAutoExpandColumn("volume");
gridGen.setBorders(true);
gridGen.setStripeRows(true);
gridGen.setColumnLines(true);
gridGen.setLoadMask(true);
gridGen.addPlugin(re);
final ColumnModel cmVol = new ColumnModel(getcolumnConfigVolume());
final EditorGrid<LineItemModel> gridVolume = new EditorGrid<LineItemModel>(store, cmVol);
final ColumnModel cmCalc = new ColumnModel(getcolumnConfigCalc());
final EditorGrid<LineItemModel> gridCalculation = new EditorGrid<LineItemModel>(store, cmCalc);
ContentPanel cp = new ContentPanel();
cp.setIcon(Resources.ICONS.table());
cp.setHeading("Compressor Settel Out Calculation v1.0 Beta");
cp.setFrame(true);
cp.setSize(990, 400);
cp.setLayout(new FitLayout());
cp.setHeaderVisible(false);
cp.add(gridGen);
ToolBar toolBar = new ToolBar();
Button add = new Button("Add Item");
add.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
LineItemModel item = new LineItemModel();
item.setVolume(0.0);
item.setInventory(0.0);
item.setNormalVolumn(0.0);
item.setMoles(0.0);
item.setMolesT(0.0)
//gridGen.stopEditing();
//store.insert(item, store.getCount());
//gridGen.startEditing(store.indexOf(item), 0);
re.stopEditing(true);
store.insert(item, store.getCount());
re.startEditing(store.indexOf(item), true);
gridGen.repaint();
}
});
Error: (:|
16:28:28.327 [ERROR] [settleoutcalcsext] Uncaught exception escaped
com.google.gwt.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
at com.google.gwt.user.client.Event$NativePreviewEvent.fire(Event.java:87)
at com.google.gwt.user.client.Event$NativePreviewEvent.access$4(Event.java:73)
at com.google.gwt.user.client.Event$.fireNativePreviewEvent(Event.java:488)
at com.google.gwt.user.client.DOM.previewEvent(DOM.java:1328)
at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)