Results 1 to 3 of 3

Thread: How do I add CheckBox into TreeGrid?

  1. #1
    Sencha User
    Join Date
    Jan 2015
    Posts
    29

    Default How do I add CheckBox into TreeGrid?

    I am using GXT3.1.2/GWT2.6 I want to add checkbox into a TreeGrid, but does not work well. When I click on the checkbox, all values in the row are changed to "true". And when I click again, it throws an exception. Please help.

    Here is my code:

    ColumnConfig<OBTInputTuple, Boolean> cc3 = new ColumnConfig<OBTInputTuple, Boolean>(new ValueProvider<OBTInputTuple, Boolean>(){

    @Override public Boolean getValue(OBTInputTuple object) { return object.isMandatory(); } @Override public void setValue(OBTInputTuple object, Boolean value) { object.setMandatory(value); } @Override public String getPath() { return null; } }); cc3.setCell(new CheckBoxCell()); cc3.setWidth(200); cc3.setHeader("Mandatory");tbL3s.jpgWhen I click the check box again:
    com.google.gwt.event.shared.UmbrellaException: Exception caught: Item was not already in the store, cannot be updated at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129) at com.sencha.gxt.data.shared.Store.fireEvent(Store.java:610) at com.sencha.gxt.data.shared.Store$Record.addChange(Store.java:174) at com.sencha.gxt.widget.core.client.grid.Grid$2.update(Grid.java:878) at com.sencha.gxt.cell.core.client.form.CheckBoxCell.onBrowserEvent(CheckBoxCell.java:171) at com.sencha.gxt.cell.core.client.form.CheckBoxCell.onBrowserEvent(CheckBoxCell.java:1) at com.sencha.gxt.widget.core.client.grid.Grid.fireEventToCell(Grid.java:875) at com.sencha.gxt.widget.core.client.grid.Grid.handleEventForCell(Grid.java:907) at com.sencha.gxt.widget.core.client.grid.Grid.onBrowserEvent(Grid.java:594) at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1467) at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1406) at com.google.gwt.user.client.impl.DOMImplStandard.dispatchEvent(DOMImplStandard.java:323) at sun.reflect.GeneratedMethodAccessor144.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) at com.google.gwt.core.client.impl.Impl.apply(Impl.java) at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:347) at sun.reflect.GeneratedMethodAccessor140.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.AssertionError: Item was not already in the store, cannot be updated at com.sencha.gxt.data.shared.ListStore.update(ListStore.java:370) at com.sencha.gxt.widget.core.client.treegrid.TreeGrid.onRecordChange(TreeGrid.java:1030) at com.sencha.gxt.widget.core.client.treegrid.TreeGrid$1.onRecordChange(TreeGrid.java:253) at com.sencha.gxt.data.shared.event.StoreRecordChangeEvent.dispatch(StoreRecordChangeEvent.java:113) at com.sencha.gxt.data.shared.event.StoreRecordChangeEvent.dispatch(StoreRecordChangeEvent.java:1) at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1) at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40) at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193) at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88) at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127) at com.sencha.gxt.data.shared.Store.fireEvent(Store.java:610) at com.sencha.gxt.data.shared.Store$Record.addChange(Store.java:174) at com.sencha.gxt.widget.core.client.grid.Grid$2.update(Grid.java:878) at com.sencha.gxt.cell.core.client.form.CheckBoxCell.onBrowserEvent(CheckBoxCell.java:171) at com.sencha.gxt.cell.core.client.form.CheckBoxCell.onBrowserEvent(CheckBoxCell.java:1) at com.sencha.gxt.widget.core.client.grid.Grid.fireEventToCell(Grid.java:875) at com.sencha.gxt.widget.core.client.grid.Grid.handleEventForCell(Grid.java:907) at com.sencha.gxt.widget.core.client.grid.Grid.onBrowserEvent(Grid.java:594) at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1467) at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1406) at com.google.gwt.user.client.impl.DOMImplStandard.dispatchEvent(DOMImplStandard.java:323) at sun.reflect.GeneratedMethodAccessor144.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) at com.google.gwt.core.client.impl.Impl.apply(Impl.java) at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:347) at sun.reflect.GeneratedMethodAccessor140.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) at java.lang.Thread.run(Unknown Source)



  2. #2
    Sencha User
    Join Date
    Jul 2011
    Location
    Germany
    Posts
    223

    Default

    I guess
    Code:
    public String getPath() { return null; }
    is to blame. Each ValueProvider has to have a unique path. Otherwise Store (not just TreeStore) gets confused.

  3. #3
    Sencha User
    Join Date
    Jan 2015
    Posts
    29

    Default

    what should set for the Path? it has to be a unique non-null value? I am not sure what it does. The java doc just said "Returns the path that this ValueProvider makes available, from the object, to the value.". I dont know what that mean...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •