Announcement

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

    JavaScriptException from ListGrid scrollToRow

    I have a ListGrid, which is shown / hidden using a button. When my application is first loaded, it calls hide() on the grid to hide it. When the (show/hide) button is clicked, the application calls show() on the grid followed by scrollToRow() call to scroll the grid to a particular row. However, the scrollToRow() call throws a JavaScriptException (refer to the errors at the end of the message). The exception is thrown in all browsers I've tested with - IE 8, FF 3.6, Chrome 8x. I'm using SGWT 2.4 12/23 nightly build.

    I've tried my best to reproduce the problem in a standalone application, but couldn't do so. It works fine in a simple standalone test case. Only in the real application, where I have the list grid nested inside a layout (along with other widgets), which in turn are a part of TabSet, I see the issue.

    So, obviously this problem is happening in special cases. I was very reluctant to post this message in this forum because I know there's very little chance of getting a response without giving any code sample or a standalone test case. But I've tried everything else I could do to troubleshoot the problem, but without any luck. I'll really appreciate any pointers that help me troubleshoot the problem. Even a workaround to scroll to a particular row would be fine.

    Thanks.

    Exception in IE 8:
    Code:
    23:31:08.828 [ERROR] [pmproc] Uncaught exception escaped
    
    com.google.gwt.core.client.JavaScriptException: (TypeError): 'undefined' is null or not an object
     number: -2146823281
     description: 'undefined' is null or not an object
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
        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.GeneratedMethodAccessor436.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: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(Unknown Source)

    Error in FF 3.6:
    Code:
    22:56:08.890 [ERROR] [pmproc] Uncaught exception escaped
    
    com.google.gwt.core.client.JavaScriptException: (TypeError): body is undefined
     fileName: http://127.0.0.1:8888
     lineNumber: 1848
     stack: (null,[object GWTJavaObject])@http://127.0.0.1:8888:1848
    @:0
    ([object GWTJavaObject],1048775,[object GWTJavaObject])@http://127.0.0.1:8888/pmproc/hosted.html?pmproc:56
    ([object Object],(void 0))@http://127.0.0.1:8888:779
    ((function () {var param = {};var event = __gwt_makeJavaInvoke(1)(null, 2621559, param);__gwt_makeJavaInvoke(1)(selfJ, 1048775, event);var ret = __gwt_makeJavaInvoke(0)(event, 1179650);return !ret;}),[object Object],[object Object])@http://127.0.0.1:8888:6
    @:0
    (null,65630,(function () {var param = {};var event = __gwt_makeJavaInvoke(1)(null, 2621559, param);__gwt_makeJavaInvoke(1)(selfJ, 1048775, event);var ret = __gwt_makeJavaInvoke(0)(event, 1179650);return !ret;}),[object Object],[object Object])@http://127.0.0.1:8888/pmproc/hosted.html?pmproc:56
    ([object Object],(void 0))@http://127.0.0.1:8888:76
    ([object Object],(void 0))@http://127.0.0.1:8888:13
    isc_StatefulCanvas_handleActivate([object Object],(void 0))@http://127.0.0.1:8888/pmproc/sc/modules/ISC_Foundation.js:296
    isc_StatefulCanvas_handleClick([object Object],(void 0))@http://127.0.0.1:8888/pmproc/sc/modules/ISC_Foundation.js:298
    isc_c_EventHandler_bubbleEvent([object Object],"click")@http://127.0.0.1:8888/pmproc/sc/modules/ISC_Core.js:1498
    isc_c_EventHandler_handleClick([object Object])@http://127.0.0.1:8888/pmproc/sc/modules/ISC_Core.js:1346
    isc_c_EventHandler__handleMouseUp([object MouseEvent],(void 0))@http://127.0.0.1:8888/pmproc/sc/modules/ISC_Core.js:1333
    isc_c_EventHandler_handleMouseUp([object MouseEvent])@http://127.0.0.1:8888/pmproc/sc/modules/ISC_Core.js:1324
    isc_c_EventHandler_dispatch(isc_c_EventHandler_handleMouseUp,[object MouseEvent])@http://127.0.0.1:8888/pmproc/sc/modules/ISC_Core.js:1561
    anonymous([object MouseEvent])@http://127.0.0.1:8888/pmproc/sc/modules/ISC_Core.js:38
    
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
        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.GeneratedMethodAccessor58.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: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(Unknown Source)

    Error in Chrome 8x:
    Code:
    23:29:37.359 [ERROR] [pmproc] Uncaught exception escaped
    
    com.google.gwt.core.client.JavaScriptException: (TypeError): Cannot call method 'scrollTo' of undefined
     stack: TypeError: Cannot call method 'scrollTo' of undefined
        at [object Object].<anonymous> (unknown source)
        at __gwt_jsInvoke (http://127.0.0.1:8888/pmproc/hosted.html?pmproc:76:35)
        at eval at <anonymous> (http://127.0.0.1:8888/pmproc/hosted.html?pmproc:54:12)
        at Object.<anonymous> (unknown source)
        at unknown source
        at __gwt_jsInvoke (http://127.0.0.1:8888/pmproc/hosted.html?pmproc:76:35)
        at eval at <anonymous> (http://127.0.0.1:8888/pmproc/hosted.html?pmproc:54:12)
        at Object.<anonymous> (unknown source)
        at Object.click (unknown source)
        at Object.isc_StatefulCanvas_handleActivate [as handleActivate] (http://127.0.0.1:8888/pmproc/sc/modules/ISC_Foundation.js:296:108)
     type: non_object_property_call
     arguments: scrollTo,
     __gwt_ObjectId: 2843
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
        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.GeneratedMethodAccessor403.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: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(Unknown Source)

    #2
    This suggests an attempt to call scrollToRow() when the grid is not yet drawn. Be sure you only call this method once the grid is drawn (has had draw() called or as has been added to a parent which is drawn).

    Comment


      #3
      Awesome. You hit the nail on its head. That was indeed the problem. The parent was not drawn in some cases. I had to call draw() on the parent (layout) to get it to work. Sometimes I got a warning that the layout was already drawn. To overcome that, I'm checking isDrawn() before calling draw().

      I still need to educate myself on the entire show/hide/draw/redraw mechanism. I thought calling show() / hide() on the parent layout would be sufficient to display or hide the grid. I wasn't familiar with draw(). I'll read the docs and browse the forums to learn more.

      Thanks so much for your help.

      Comment


        #4
        Another useful API to keep in mind is the addDrawHandler(..) which gets executed when the widget gets drawn.

        Comment


          #5
          Thanks Sanjiv.

          I really appreciate your help. I'm still a beginner in GWT and SmartGWT and hopefully will be (paying) customer some day.

          Comment

          Working...
          X