Announcement

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

    JavaScriptException occurs when ListGrid.fetchData invoked in GWT 2.0 dev mode

    I have problems with
    SmartGWT 2.0 and GWT 2.0.1
    in development mode. I get a
    Code:
    com.google.gwt.core.client.JavaScriptException: (null): null
    when I execute code like the test case below.
    I checked it with different environments, and these are the results:
    o SmartGWT 1.3 and GWT 1.7 hosted + compiled: works, "done" is logged
    o SmartGWT 2.0 and GWT 2.0.1 compiled: works, "done" is logged
    o SmartGWT 2.0 and GWT 2.0.1 dev: I get the exception below

    Code:
        public void onModuleLoad() {
        	
        	final ListGridRecord [] records = new ListGridRecord[1];
        	records[0] = new ListGridRecord();
        	records[0].setAttribute("myAttribute", "attributeValue");
        	
            DataSource ds = new DataSource() {        	        	        	
            	@Override
                protected Object transformRequest(DSRequest dsRequest) {
                    DSOperationType opType = dsRequest.getOperationType();
                    if (DSOperationType.FETCH == opType) {
                        return records;
                    } else {
                    	// just for test
                    	return null;
                    }
            	}
            };
            ds.setClientOnly(true);        
            
            DataSourceTextField name = new DataSourceTextField("myAttribute");
            ds.setFields(name);
            
            TextItem nameItem = new TextItem("myAttribute");
            ListGridField nameGridField = new ListGridField("myAttribute");
            nameGridField.setEditorType(nameItem);
            
            ListGrid listGrid = new ListGrid();
            listGrid.setDataSource(ds);
            listGrid.setFields(nameGridField);
            
            listGrid.fetchData(null, new DSCallback() {
                public void execute(DSResponse response, Object rawData, DSRequest request) {
                    Log.debug("done");
                }                    
            });        
            
        }
    The exception stack trace is
    Code:
    com.google.gwt.core.client.JavaScriptException: (null): null
     	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:195)
     	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
     	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
     	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:284)
     	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
     	at com.smartgwt.client.widgets.grid.ListGrid.fetchData(ListGrid.java)
     	at com.ect.gwt.vcb.client.VisualCallflowBuilder.onModuleLoad(VisualCallflowBuilder.java:139)
     	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     	at java.lang.reflect.Method.invoke(Method.java:597)
     	at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:369)
     	at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:185)
     	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:380)
     	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
     	at java.lang.Thread.run(Thread.java:619)
    Any ideas?

    #2
    I continued checking the problem and found one solution which might be a hint: When changing the DataSource to just return null for FETCH as can be seen below, the code works. So with the current SmargGWT version, the list grid records returned for FETCH seem to be handled in a different way.

    Any ideas what is wrong with the example or what change so that the code works as with SmartGWT 1.3 and GWT 1.7?

    Code:
            DataSource ds = new DataSource() {        	        	        	
            	@Override
                protected Object transformRequest(DSRequest dsRequest) {
                    DSOperationType opType = dsRequest.getOperationType();
                    if (DSOperationType.FETCH == opType) {
                        /*                	
                    	ListGridRecord [] records = new ListGridRecord[1];
                    	records[0] = new ListGridRecord();
                    	records[0].setAttribute("myAttribute", "attributeValue");
                    	return records;
                    	*/
                    	return null;
                    } else {
                    	// just for test
                    	return null;
                    }
            	}
            };
    Last edited by ect; 23 Feb 2010, 05:22.

    Comment


      #3
      Should I file this as a bug/issue?

      Comment


        #4
        It's on my TODO list but please go ahead and file an issue pointing to this thread.

        Sanjiv

        Comment


          #5
          This has been fixed in SVN.

          Sanjiv

          Comment

          Working...
          X