Announcement

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

    Problem with SelectItem.fetchData()

    Hi,

    I have a simple SelectItem in a DynamicForm connected to a Datasource:

    Code:
    private DataSource letterInfoDatasource = DataSource.get("LetterInfo");
    
    documents = new SelectItem("documents");
    documents.setShowTitle(false);
    documents.setWidth(400);
    
    documents.setOptionDataSource(letterInfoDatasource);
    When I try to update the elements of the picklist I use

    Code:
    documents.fetchData()
    This always gives me the following error:

    Code:
    Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError): self.fetchData is not a function
     fileName: http://localhost:8080
     lineNumber: 25
     stack: ([object GWTJavaObject])@http://localhost:8080:25
    @:0
    ([object GWTJavaObject],1179847,[object GWTJavaObject])@http://localhost:8080/installateurs-db/InstallateursDb/hosted.html?InstallateursDb:56
    ([object Object],(void 0))@http://localhost:8080:1899
    ((function () {var param = {};var event = __gwt_makeJavaInvoke(1)(null, 3866743, param);__gwt_makeJavaInvoke(1)(selfJ, 1179847, event);var ret = __gwt_makeJavaInvoke(0)(event, 1310726);return !ret;}),[object Object],[object Object])@http://localhost:8080:57
    @:0
    (null,65642,(function () {var param = {};var event = __gwt_makeJavaInvoke(1)(null, 3866743, param);__gwt_makeJavaInvoke(1)(selfJ, 1179847, event);var ret = __gwt_makeJavaInvoke(0)(event, 1310726);return !ret;}),[object Object],[object Object])@http://localhost:8080/installateurs-db/InstallateursDb/hosted.html?InstallateursDb:56
    ([object Object],(void 0))@http://localhost:8080:70
    ([object Object],(void 0))@http://localhost:8080:13
    isc_StatefulCanvas_handleActivate([object Object],(void 0))@http://localhost:8080/installateurs-db/InstallateursDb/sc/modules/ISC_Foundation.js:318
    isc_StatefulCanvas_handleClick([object Object],(void 0))@http://localhost:8080/installateurs-db/InstallateursDb/sc/modules/ISC_Foundation.js:320
    isc_c_EventHandler_bubbleEvent([object Object],"click")@http://localhost:8080/installateurs-db/InstallateursDb/sc/modules/ISC_Core.js:1552
    isc_c_EventHandler_handleClick([object Object])@http://localhost:8080/installateurs-db/InstallateursDb/sc/modules/ISC_Core.js:1400
    isc_c_EventHandler__handleMouseUp([object MouseEvent],(void 0))@http://localhost:8080/installateurs-db/InstallateursDb/sc/modules/ISC_Core.js:1387
    isc_c_EventHandler_handleMouseUp([object MouseEvent])@http://localhost:8080/installateurs-db/InstallateursDb/sc/modules/ISC_Core.js:1378
    isc_c_EventHandler_dispatch(isc_c_EventHandler_handleMouseUp,[object MouseEvent])@http://localhost:8080/installateurs-db/InstallateursDb/sc/modules/ISC_Core.js:1615
    anonymous([object MouseEvent])@http://localhost:8080/installateurs-db/InstallateursDb/sc/modules/ISC_Core.js:60
        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.invokeNativeVoid(ModuleSpace.java:289)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
        at com.smartgwt.client.widgets.form.fields.SelectItem.fetchData(SelectItem.java)
        at de.bvag.installateursdb.client.DocumentSelectorWindow.buildForm(DocumentSelectorWindow.java:43)
        at de.bvag.installateursdb.client.DocumentSelectorWindow.<init>(DocumentSelectorWindow.java:29)
        at de.bvag.installateursdb.client.FirmaEditor.createDocument(FirmaEditor.java:971)
        at de.bvag.installateursdb.client.FirmaEditor.access$5(FirmaEditor.java:969)
        at de.bvag.installateursdb.client.FirmaEditor$4.onClick(FirmaEditor.java:233)
        at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:99)
        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:96)
        at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:66)
        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.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.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.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)
    Am I doing something wrong? Is there another way to force a SelectItem to refresh it's picklist. Even creating a new SelectItem instance does not work (I assume because it is connected to the same DataSource).

    I am using SmartGWT Pro 2.5 (nightly build from 2011-02-08) on Windows and tried Firefox 3.6, Chrome and IE8. (Hope to have included all needed information this time... ;-) - still learning)


    Your's

    Jens

    #2
    Ok, just found out, that I can call fetchData() after(!) I added the SelectItem to the DynamicForm. But when I do so the picklist is not getting updated. Reloading the application is the only thing that works for me...

    Comment


      #3
      You do need to call fetchData() only after initialization (there would be no point calling it before initialization since it's going to fetch fresh data during init).

      Check the RPC tab to see whether a server call is happening (would not happen if the DataSource is clientOnly or cacheAllData:true) and whether new data is actually being returned.

      Comment


        #4
        I am facing the same issue can u please help me out with the code that solved your problem

        Comment

        Working...
        X