Announcement

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

    DynamicForm.getValuesAsRecord() doesn't work

    Hi everybody!
    I'm using a DynamicForm without a DataSource and I set its fields using the method editSelectedData() passing as parameter an instance of ListGridTable (without a DataSource too). I make a check to ensure that the selection in the table is not null.
    When I try to get data from the form invoking the method getValuesAsRecord, the following exception is thrown:
    java.lang.IllegalArgumentException: Unsupported type for attribute __ref : com.smartgwt.client.widgets.grid.ListGridRecord@1b1eb3a.

    Here's the stack trace I get:
    Code:
    java.lang.IllegalArgumentException: Unsupported type for attribute __ref : com.smartgwt.client.widgets.grid.ListGridRecord@1b1eb3a
        at com.smartgwt.client.util.JSOHelper.convertMapToJavascriptObject(JSOHelper.java:743)
        at com.smartgwt.client.widgets.form.DynamicForm.getValuesAsRecord(DynamicForm.java:2405)
        at it.txt.tipss.dataStream.ui.client.view.MessageBrokersView.getDataFromForm(MessageBrokersView.java:336)
        at it.txt.tipss.dataStream.ui.client.view.MessageBrokersView.updateData(MessageBrokersView.java:240)
        at it.txt.tipss.dataStream.ui.client.presenter.MessageBrokersPresenter$2.onClick(MessageBrokersPresenter.java:124)
        at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:96)
        at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:1)
        at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
        at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53)
        at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
        at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:71)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.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.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165)
        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.invokeNativeObject(ModuleSpace.java:264)
        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:188)
        at sun.reflect.GeneratedMethodAccessor22.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.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
        at java.lang.Thread.run(Unknown Source)
    Any suggestion is welcome!

    #2
    Post all of your relevant versions (see FAQ) and try the latest if you haven't already.

    Comment


      #3
      Here's my software versions

      SmartGWT version: 2.1
      GWT version: 2.0.3
      SO: Microsoft Windows Server 2003
      Browser: Mozilla Firefox 3.6.3
      JDK: 1.6 update 18

      The issue is raised in GWT Development Mode.

      Comment


        #4
        The exception is raised also for a Dynamic Form binded with a List Grid using the same Data Source. So I can't retrieve the data in the form as a Record.

        Comment


          #5
          I've just downloaded the new versione of SmartGWT (2.2) and tested the invocation of the method getValuesAsRecord() of DynamicForm. Now it works fine! Thank you!

          Comment


            #6
            Originally posted by Turiddu
            I've just downloaded the new versione of SmartGWT (2.2) and tested the invocation of the method getValuesAsRecord() of DynamicForm. Now it works fine! Thank you!
            I'm wrong. That method continues to throw an exception in particular when I try to get the form data from a form binded with a grid list and both widgets share the same Data Source.

            Here is the stack trace:
            Code:
            19:47:07.062 [ERROR] [testdynamicform_getvaluesasrecord] Uncaught exception escaped
            java.lang.IllegalArgumentException: Unsupported type for attribute __ref : org.example.test.dynamicForm.client.ItemRecord@e67c1e
                at com.smartgwt.client.util.JSOHelper.convertMapToJavascriptObject(JSOHelper.java:748)
                at com.smartgwt.client.widgets.form.DynamicForm.getValuesAsRecord(DynamicForm.java:2553)
                at org.example.test.dynamicForm.client.TestDynamicForm_getValuesAsRecord$3.onClick(TestDynamicForm_getValuesAsRecord.java:75)
                at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:96)
                at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:1)
                at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
                at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53)
                at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
                at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:67)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.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.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713)
                at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165)
                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.invokeNativeObject(ModuleSpace.java:264)
                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:188)
                at sun.reflect.GeneratedMethodAccessor24.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.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
                at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
                at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
                at java.lang.Thread.run(Unknown Source)
            I post again my configuration:
            IDE: Eclipse Galileo (3.5.2)
            GWT: 2.0.3
            SmartGWT: 2.2
            OS: MS Windows Server 2003, MS Windows Vista
            Browser: Firefox 3.6.3, IE 8.

            I've attached a stand-alone test case showing the issue. The code is similar to the Grid-Form binding - Update sample of the SmartGWT showcase (original class: GridFormUpdateSample).

            Any fix or suggestion???
            Attached Files

            Comment


              #7
              Nothing new? Is it possible that noboby has faced this issue?

              Comment


                #8
                getValuesAsRecord() returns

                04:00:49.468 [ERROR] [debug] Uncaught exception escaped
                java.lang.IllegalArgumentException: Unsupported type for attribute __ref : com.smartgwt.client.widgets.grid.ListGridRecord@877f0f
                at com.smartgwt.client.util.JSOHelper.convertMapToJavascriptObject(JSOHelper.java:748)
                at com.smartgwt.client.widgets.form.DynamicForm.getValuesAsRecord(DynamicForm.java:2553)

                Comment


                  #9
                  Hi ,
                  I did the following and it works !!!!

                  @SuppressWarnings("unused")
                  Map values =getValues();
                  Map m2 = new HashMap();
                  m2.putAll(values);
                  m2.remove("__ref");
                  Record rec = new Record(JSOHelper.convertMapToJavascriptObject(m2)));

                  Comment


                    #10
                    Originally posted by Turiddu
                    Nothing new? Is it possible that noboby has faced this issue?
                    Please file an issue in tracker with a link to this thread.

                    Thanks,
                    Sanjiv

                    Comment


                      #11
                      I got the same problem. __ref is a ListGridRecord and JSOHelper's convertMapToJavascriptObject(Map) does not know how to handle such an object, obviously.

                      I also suspect this problem only occurs when editing data based on what is selected in a corresponding (i.e. with the same datasource) Grid with DynamicForm's editSelectedData(ListGrid).

                      The workaround proposed above works for me too (just deleting __ref from the getValues() returned map directly though).

                      Comment


                        #12
                        Fixed, please try the next nightly build.

                        Sanjiv

                        Comment

                        Working...
                        X