Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid problem with EditingNew and ExpandRecords

    I'm using SC_SNAPSHOT-2010-09-04/PowerEdition Deployment with Firefox 3.6.

    When a user edits a new record and then expands that new record before hitting enter to save the edit, the follow exception is thrown:
    Code:
    12:31:50.240 [ERROR] [Ping] Uncaught exception escaped
    com.google.gwt.core.client.JavaScriptException: (String): Invoking an instance method on a null instance
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.google.gwt.dev.shell.ModuleSpace.createJavaScriptException(ModuleSpace.java:70)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:60)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeBoolean(ModuleSpace.java:184)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeBoolean(JavaScriptHost.java:35)
        at com.smartgwt.client.widgets.grid.ListGrid.canExpandRecord(ListGrid.java)
        at sun.reflect.GeneratedMethodAccessor36.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:157)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
        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:214)
        at sun.reflect.GeneratedMethodAccessor29.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:157)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
        at java.lang.Thread.run(Thread.java:619)

    I've attached a small program to reproduce what I am seeing:
    Code:
    package com.smartgwt.sample.client;
    
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.widgets.Canvas;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.layout.HLayout;
    import com.smartgwt.client.widgets.layout.VStack;
    
    public class Ping implements EntryPoint 
    {
    	public void onModuleLoad() 
    	{
    		final Canvas mainCanvas = new Canvas();
    		mainCanvas.setHeight100();
    		mainCanvas.setWidth100();
    		mainCanvas.setBackgroundColor("green");
    
    		final ListGrid grid = new ListGrid();
    		grid.setDataSource(DataSource.get("PING"));
    		grid.setWidth100();
    		grid.setHeight100();
    		grid.setCanExpandRecords(true);
    		grid.setCanRemoveRecords(true);
    		grid.fetchData();
    
    
    		final IButton newBtn = new IButton("new");
    		newBtn.enable();
    		newBtn.addClickHandler(new ClickHandler() {
    			public void onClick(ClickEvent event) {
    				grid.startEditingNew();
    			}
    		});
    
    		final HLayout hLayout = new HLayout(10);
    		hLayout.setMembersMargin(10);
    		hLayout.setHeight(22);
    		hLayout.addMember(newBtn);
    
    		final VStack vstack = new VStack();
    		vstack.setLeft(10);
    		vstack.setTop(10);
    		vstack.setWidth("80%");
    		vstack.setHeight("80%");
    		vstack.setMembersMargin(10);
    		vstack.addMember(grid);
    		vstack.addMember(hLayout);
    
    		mainCanvas.addChild(vstack);
    		mainCanvas.draw();
    	}
    }
    Note this exception happens with or without the form that is displayed for the expanded record. For simplicity, I left off the form that is displayed in the record in the example reproducer.
    And the PING.ds.xml:
    Code:
    <DataSource 
    	schema="PING"
    	dbName="Oracle"
    	tableName="PING"
    	ID="PING"
    	serverType="sql"
    >
    	<fields>
    		<field sequenceName="PING_SEQ" primaryKey="true" name="id" type="sequence" hidden="true"></field>
    		<field name="name" length="51" type="text">
    			<validators>
    				<validator type="isUnique" requiresServer="true" />
    			</validators>
    		</field>
    		<field name="other" length="21" type="text">
    		</field>
    	</fields>
    	
    </DataSource>
    I would expect the save to happen before the row expansion is fired and not generate an exception. Did I go about the code for this wrong?

    #2
    It's possible that this crash has been corrected in the latest, however, it wouldn't kick off an automatic save, so you'd still want to register a RecordExpanded event handler to do that, and, if you do, that should avoid this crash as well (if you defer the expansion until after the same completes). Can you give that a shot?

    Comment


      #3
      Is this what you had in mind for me to do? I added:
      Code:
      		grid.addRecordExpandHandler(new RecordExpandHandler() {
      			@Override
      			public void onRecordExpand(RecordExpandEvent event) {
      				grid.saveAllEdits();
      			}
      		});
      With Smart GWT 2.3 SC_SNAPSHOT-2010-12-14/PowerEdition Deployment, I still get the exception. I also tried it with
      Code:
      event.cancel();
      before the saveAllEdits to just prevent the expand, but an exception was still thrown. How did you have in mind to defer the expand? I'm not certain I did exactly what you suggested.

      Comment


        #4
        That's what we had in mind, but sounds like the exception is occurring too soon. We'll check it out.

        Comment


          #5
          Ok this should now be resolved
          We don't support expanding a row with no underlying record (for example a new edit-row which has not yet been saved) so you should never have been getting into this state. We've added some checks which will correctly suppress this logic from running (and crashing).

          The change will be present in the next nightly build - please let us know if you continue to see the problem

          Comment


            #6
            Hi, my have faced almost the same problem.

            After invoke startEditingNew(), I tried to expand the record, so that I able to add record to the nested Grid.

            But at last I hit the following error and warning, any alternative that I can expand the record for new-edit-row:

            Code:
            com.google.gwt.core.client.JavaScriptException: (String): Invoking an instance method on a null instance
            	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
            	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
            	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
            	at com.google.gwt.dev.shell.ModuleSpace.createJavaScriptException(ModuleSpace.java:70)
            	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:60)
            	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
            	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
            	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
            	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
            	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
            	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
            	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
            	at com.smartgwt.client.widgets.grid.ListGrid.expandRecord(ListGrid.java)
            Code:
            com.smartgwt.client.core.JsObject$SGWT_WARN: 15:17:58.387:MUP4:WARN:Log:findByKeys: passed record does not have a value for key field 'id'
                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
                at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
                at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
                at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
                at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
                at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
                at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
                at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
                at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
                at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
                at com.smartgwt.client.widgets.grid.ListGrid.getValueIcon(ListGrid.java)
                at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:585)
                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:157)
                at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
                at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
                at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
                at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
                at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
                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:214)
                at sun.reflect.GeneratedMethodAccessor101.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:585)
                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:157)
                at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
                at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
                at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
                at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
                at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
                at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
                at com.smartgwt.client.widgets.grid.ListGrid.startEditingNew(ListGrid.java)
                at com.seagate.profile.client.tab.section.view.BaseNestedGridSectionViewImpl$8.onClick(BaseNestedGridSectionViewImpl.java:147)
                at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:98)
                at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:1)
                at com.google.gwt.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:204)
                at com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:103)
                at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:101)
                at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:66)
                at sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:585)
                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:157)
                at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
                at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
                at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
                at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
                at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
                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:214)
                at sun.reflect.GeneratedMethodAccessor101.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:585)
                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:157)
                at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
                at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
                at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
                at java.lang.Thread.run(Thread.java:595)

            Comment

            Working...
            X