Announcement

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

    ListGrid.saveViewState fails after installing v8.3p_2013-02-08 build

    Hello,

    When we create a ListGrid instance this error pops up: '(TypeError): this.completeFields is undefined'.

    We call the 'getOrCreateJsObj' from our override of 'com.smartgwt.client.widgets.grid.ListGrid.onInit()' (where we first call the super implementation which goes ok and then call custom code which calls the 'getOrCreateJsObj' at some point). This triggers a change event which in its turn triggers the saveViewState. Not sure if the event was not firing before or that there is something going wrong in the saveViewState now.

    Code:
    com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:248)
    com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
    com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    com.smartgwt.client.widgets.grid.ListGrid.getViewState(ListGrid.java)
    foo.bar.client.util.ViewStateTracker.saveViewState(ViewStateTracker.java:54)
    foo.bar.client.util.ViewStateTracker.onFieldStateChanged(ViewStateTracker.java:20)
    com.smartgwt.client.widgets.grid.events.FieldStateChangedEvent.dispatch(FieldStateChangedEvent.java:100)
    com.smartgwt.client.widgets.grid.events.FieldStateChangedEvent.dispatch(FieldStateChangedEvent.java:1)
    com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
    com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
    com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
    com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
    com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
    com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:71)
    sun.reflect.GeneratedMethodAccessor340.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
    com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
    com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
    com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
    sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
    com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
    com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
    com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    com.smartgwt.client.widgets.grid.ListGrid.create(ListGrid.java)
    com.smartgwt.client.widgets.BaseWidget.getOrCreateJsObj(BaseWidget.java:386)
    foo.bar.client.FooListGrid.initMethod(FooListGrid.java:1704)
    The error is slightly different in compiled mode '(TypeError): Cannot call method 'find' of undefined' but seems to come from same source:

    Code:
    Unknown.isc_ListGrid_getGroupState(Unknown Source)
    Unknown.isc_ListGrid_getViewState(Unknown Source)
    Unknown.$getViewState(Unknown Source)
    Unknown.$saveViewState(Unknown Source)
    Unknown.onFieldStateChanged(Unknown Source)
    Unknown.$dispatch_91(Unknown Source)
    Unknown.dispatch_92(Unknown Source)
    Unknown.dispatch(Unknown Source)
    Unknown.dispatchEvent_1(Unknown Source)
    Unknown.$doFire(Unknown Source)
    I assume both errors are related somehow.

    This seems to be unrelated to a browser type and was not noticed on the previous version we where running.

    Thanks for having a look.
    Last edited by hin3x; 8 Feb 2013, 07:57.

    #2
    It's unclear from your description whether we have a true framework error here or whether it's just a case of your application code happening to trip an invalid series of events. We could possibly attempt to resolve this by adding some preemptive null checks to saveViewState or related methods, but without understanding the route cause of the issue that may not be good enough.

    The best way to proceed here would be to show us how to reproduce this with a simple test case so we can determine whether there's a true framework bug or not.

    Regards
    Isomorphic Software

    Comment


      #3
      Hello,

      After some tinkering I managed to get this one out, you will see an error firing when it gets in the 'onFieldStateChanged' code. The cause seems to be calling 'setGroupByField', if I remove that line the error does not show.

      The change event is fired because we hide some fields, as also illustrated below.

      Code:
      	private class MyType extends SimpleType {
      		public MyType() {
      			super("mine", FieldType.ANY);
      
      			IntegerRangeValidator v = new IntegerRangeValidator();
      			v.setMin(1);
      			v.setMax(10);
      			setValidators(v);
      		}
      	}
      
      	public Canvas getViewPanel() {
      		new MyType().register();
      
      		final MyListGrid grid = new MyListGrid();
      		grid.setWidth(400);
      		grid.setHeight(200);
      		String fieldName1 = "a";
      		String fieldName2 = "b";
      		ListGridField field1 = new ListGridField(fieldName1);
      		field1.setAttribute("type", "mine");
      		ListGridField field2 = new ListGridField(fieldName2);
      		grid.setFields(field1, field2);
      		
      		grid.setSortField(fieldName2);
      		// Comment this one to make the error go away
      		grid.setGroupByField(fieldName1);
      
      		ListGridRecord record1 = new ListGridRecord();
      		record1.setAttribute(fieldName1, "aha1");
      		record1.setAttribute(fieldName2, "oho1");
      
      		ListGridRecord record2 = new ListGridRecord();
      		record2.setAttribute(fieldName1, "aha2");
      		record2.setAttribute(fieldName2, "oho2");
      
      		grid.setRecords(new ListGridRecord[]{record1, record2});
      		
      		grid.hideField(fieldName1);
      		
      
      
      		Button addData = new Button("startEditingNew");
      		addData.addClickHandler(new ClickHandler() {
      
      			public void onClick(ClickEvent event) {
      				Record newRecordDefaults = new Record();
      				grid.startEditingNew(newRecordDefaults);
      			}
      		});
      		
      		VLayout layout = new VLayout();
      		layout.setWidth100();
      		layout.addMembers(addData, grid);
      		return layout;
      	}
      	
      	private class MyListGrid extends ListGrid {
      
      		public MyListGrid() {
      			super();
      			setID("gridxxx1");
      			setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
      			
      			setShowGridSummary(true);	
      			setShowFilterEditor(true);
      			setAllowFilterExpressions(true);			
      			setGroupStartOpen(GroupStartOpen.ALL);
      			setSelectionType(SelectionStyle.SINGLE);
      			setOverflow(Overflow.VISIBLE);
      			
      			addFieldStateChangedHandler(new FieldStateChangedHandler() {
      				
      				@Override
      				public void onFieldStateChanged(FieldStateChangedEvent event) {
      					
      					System.out.println(MyListGrid.this.getViewState());
      				}
      			});						
      			
      		}
      
      	}
      thanks!

      Comment


        #4
        We're taking a look

        Regards
        Isomorphic Software

        Comment


          #5
          Thanks - the test case was very helpful.
          We've made a change which should take care of this issue. Please try the next nightly build (dated Feb 12)

          Regards
          Isomorphic Software

          Comment


            #6
            Hello,

            Just tested this on 'v8.3p_2013-02-12/Pro Deployment 2013-02-12' and I still get the error in our app.

            My test case is also giving the same error again, is there something wrong with the build - was the fix not included?
            Last edited by hin3x; 13 Feb 2013, 01:32.

            Comment


              #7
              The fix had only been applied to the 9.0/4.0 branch. We have now ported it to the 8.3/3.1 branch.

              Comment

              Working...
              X