Announcement

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

    error on GridList.getRecords()

    I have the build 1.0b2 and get upon calling the method getRecords of ListGrid the following error.
    What am I missing here?
    Thanks!

    [ERROR] Uncaught exception escaped
    com.google.gwt.dev.shell.HostedModeException: Expected primitive type int; actual value was undefined
    at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:51)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:206)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:75)
    at com.smartgwt.client.util.JSOHelper.getJavaScriptObjectArraySize(JSOHelper.java)
    at com.smartgwt.client.util.JSOHelper.toArray(JSOHelper.java:66)
    at com.smartgwt.client.widgets.grid.ListGrid.convertToListGridRecordArray(ListGrid.java:5341)
    at com.smartgwt.client.widgets.grid.ListGrid.getRecords(ListGrid.java:4878)
    at com.gui.test.client.watchlist.actions.SaveWatchlistClickListener.onClick(SaveWatchlistAction.java:35)
    at com.google.gwt.user.client.ui.ClickListenerCollection.fireClick(ClickListenerCollection.java:34)
    at com.google.gwt.user.client.ui.FocusWidget.onBrowserEvent(FocusWidget.java:102)
    at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1308)
    at com.google.gwt.user.client.DOM.dispatchEventAndCatch(DOM.java:1287)
    at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1255)
    at sun.reflect.GeneratedMethodAccessor279.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.ie.IDispatchImpl.callMethod(IDispatchImpl.java:126)
    at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155)
    at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294)
    at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194)
    at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
    at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
    at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720)
    at com.google.gwt.dev.GWTShell.run(GWTShell.java:593)
    at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)

    #2
    There were some problems with the getRecords() API reported and fixes early on. Try that latest nightly or build from SVN.

    Comment


      #3
      I get this error with revision 252. Will try later SVN...
      Using a workaround:
      Code:
      int size = grid.getTotalRows();
      ListGridRecord record = null;
      for (int i = 0; i < size; i++) {
      	record = grid.getRecord(i);
      	...
      }
      thanks Isomorphic!

      Comment


        #4
        Are you using a ListGrid or a TreeGrid? I tried calling ListGrid.getRecords on one of the Showcase grid samples and it worked fine. Can you post a standalone test?

        Thanks,
        Sanjiv

        Comment


          #5
          getRecords() does not appear to work with the TreeGrid. Returns empty list. Using nightly build from Jan 23.

          Comment


            #6
            im experiencing the same problem with 1.1

            I have a ListGrid and every time a make a call to getRecords() the same exception occours.

            the funny thing is when i do not attach the widget to a container everything works fine; once it gets attached the exception occours

            i'm going to test the workaround proposed by pascalpug

            Code:
            com.google.gwt.dev.shell.HostedModeException:
            Expected primitive type int; actual value was undefined
                at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:51)
                at com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:209)
                at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:75)
                at com.smartgwt.client.util.JSOHelper.getJavaScriptObjectArraySize(JSOHelper.java)
                at com.smartgwt.client.util.JSOHelper.toArray(JSOHelper.java:70)
                at com.smartgwt.client.widgets.grid.ListGrid.convertToListGridRecordArray(ListGrid.java:5291)
                at com.smartgwt.client.widgets.grid.ListGrid.getRecords(ListGrid.java:4942)
                at ... < CUT >
            -----
            edit:
            i just tested the workaround:
            well the exeption is gone, but it seems i have a deeper problem

            when the grid is visible:
            afer an addData operation the grid reports ( with the workaround method ) that it is emty

            when the grid was not yet drawn:
            after an addData operation the grid reports the inserted entry

            any ideas?

            crimson
            Last edited by crimson; 8 Jul 2009, 06:31.

            Comment


              #7
              Originally posted by crimson
              im experiencing the same problem with 1.1

              I have a ListGrid and every time a make a call to getRecords() the same exception occours.

              the funny thing is when i do not attach the widget to a container everything works fine; once it gets attached the exception occours
              Can you post a standalone test case, or a modification to an existing showcase sample that illustrates the problem?

              Comment


                #8
                i tracked down my problem to the grouping function
                the above described problem only occours when grouping is enabled

                is it intended that some Record related methods ( addData, getRecords, .. ) change their behavior when you enable grouping?

                Comment


                  #9
                  I believe that once you group a ListGrid the internal structure gets converted to a TreeGrid and you no longer have access to the original data that you entered into the listgrid.

                  In order to get records out once grouped I just ungroup, getRecords and then group again to work around it - not ideal but it works.

                  Comment


                    #10
                    We've added a ListGrid.getGroupTree() to return the underlying Tree datastructure when the ListGrid is grouped on a field.

                    Edit : getRecords() will now work even when the ListGrid is grouped.

                    Once you have the Tree data structure, you can navigate the Tree using the appropriate API's.
                    Last edited by smartgwt.dev; 9 Jul 2009, 08:16.

                    Comment


                      #11
                      getting error with trunk

                      Hi, I built smartgwt1.1 from the trunk (first-timer :)) and re-ran my code, but still get the errro 'Expected primitive type int; actual value was undefined' on getRecords():
                      I thought this would be the fixed source, but doesn't look like it. Is there another repository for updated code that I should build from?
                      UPdate: I just ran with the latest revision (http://smartgwt.build.rorschach.de/revision.618/) but am still seeing the same thing.

                      Code:
                      		ListGridRecord[] nodes = services.getRecords();
                      The error seems to occur here, in JavaScriptHost.class:
                      Code:
                      int com.google.gwt.dev.shell.ShellJavaScriptHost.invokeNativeInt(String name, Object jthis, Class<?>[] types, Object[] args) throws Throwable
                      Code:
                       /**
                         * Invoke a native JavaScript function that returns an integer value.
                         */
                        public static int invokeNativeInt(String name, Object jthis,
                            Class<?>[] types, Object[] args) throws Throwable {
                          return sHost.invokeNativeInt(name, jthis, types, args);
                        }
                      Stacktrace
                      Code:
                      [ERROR] Unable to load module entry point class com.mycompany.client.TestListGrid (see associated exception for details)
                      com.google.gwt.dev.shell.HostedModeException: Expected primitive type int; actual value was undefined
                      	at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:51)
                      	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:206)
                      	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:75)
                      	at com.smartgwt.client.util.JSOHelper.getJavaScriptObjectArraySize(JSOHelper.java)
                      	at com.smartgwt.client.util.JSOHelper.toArray(JSOHelper.java:80)
                      	at com.smartgwt.client.widgets.grid.ListGrid.convertToListGridRecordArray(ListGrid.java:5397)
                      	at com.smartgwt.client.widgets.grid.ListGrid.getRecords(ListGrid.java:5030)
                      	at com.mycompany.client.TestListGrid.onModuleLoad(TestListGrid.java:33)
                      	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:585)
                      	at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:320)
                      	at com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:329)
                      	at com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access$300(BrowserWidgetIE6.java:37)
                      	at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad(BrowserWidgetIE6.java:76)
                      	at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.invoke(BrowserWidgetIE6.java:139)
                      	at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294)
                      	at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194)
                      	at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
                      	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
                      	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
                      	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
                      	at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720)
                      	at com.google.gwt.dev.GWTShell.run(GWTShell.java:593)
                      	at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)
                      Thanks,
                      Dave
                      Last edited by ddumaresq; 16 Jul 2009, 09:24.

                      Comment


                        #12
                        Error: Expected primitive type int - example attached

                        I'm still having the issue with "Expected primitive type int; actual value was undefined" even though I'm using the latest revision (618) of smartgwt.

                        Please note, I cannot use the workaround suggested by pascalpug, because the value I get for getTotalRows is always 1000

                        Code:
                        	int size = this.getTotalRows();
                        	system.out.println("total rows = " + size);
                        
                                total rows = 1000
                        However, I can workaround that using:
                        Code:
                        		int size = services.getTotalRows();
                        		ListGridRecord record = null;
                        		boolean stop = false;
                        		for (int i = 0; i < size | stop; i++) {
                        			record = services.getRecord(i);
                        			if (record == null)
                        				stop = true;
                        			System.out.println("size = " + i);
                        		}
                        		
                        		System.out.println("services.size = " + size);
                        Still I like to get to the bottom of why ListGrid.getRecords() isn't working for me.



                        I've attached a complete example; this post contains 5/9 files, see next post for remaining 4 files.

                        Thanks,
                        Dave
                        Attached Files
                        Last edited by ddumaresq; 16 Jul 2009, 09:38. Reason: Upload individual files

                        Comment


                          #13
                          additional files

                          other required files...
                          Attached Files

                          Comment


                            #14
                            ListGrid.getRecords not working for me - example provided

                            Would someone tell me if they are seeing the same thing as I am?
                            Several posts back it was reported that getRecords is working ... what am I doing wrong?

                            Thanks,
                            Dave

                            Comment


                              #15
                              Odd ... works after first run

                              I'm testing this in hosted mode and notice that after the first error

                              Code:
                              com.google.gwt.dev.shell.HostedModeException: 
                              Expected primitive type int; actual value was undefined),
                              I can refresh the development shell and the problem goes away... Unfortunately, this is not the case when I choose Compile/Browse and the app runs inside FireFox.

                              Dave

                              Comment

                              Working...
                              X