Announcement

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

    SmartGWT 2.2 Criteria (DSRequest.getCriteria()) object changed?

    After upgrade to 2.2 getting SerializationException

    Before upgrading I was on 2.1 and this was working now after I'm getting the SerializationException when entering filter data and pushing enter via the top filter bar above a ListGrid.

    Using
    GWT 2.0.3
    SmartGWT 2.2 (Nightly build due to other issue that was fixed)

    Was something changed that would cause this error in 2.2 but not 2.1?

    DSRequest.getCriteria() returns a Criteria object but getValues no longer returns the field names and values for the Criteria as it did is there another way to get those values from this updated object in 2.2?

    It seems to be where I'm using Criteria that something changed in the object for 2.2 :
    Code:
    Criteria c = request.getCriteria();
    HashMap criteriaMap = (HashMap)c.getValues();
    was in 2.1:
    {itmid=TP*}
    
    is now in 2.2:
    {operator=and, _constructor=AdvancedCriteria, criteria=[object Object]}

    Code:
    01/06/2010 17:12:41 [ERROR] com.eonegroup.dashboard.client.rpc.SGWTItemService_Proxy:61 - DSAsyncCallback::onFailure
    com.google.gwt.user.client.rpc.SerializationException:
    null
        at com.google.gwt.user.client.rpc.impl.SerializerBase.check(SerializerBase.java:161)
        at com.google.gwt.user.client.rpc.impl.SerializerBase.serialize(SerializerBase.java:145)
        at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.serialize(ClientSerializationStreamWriter.java:199)
        at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
        at com.google.gwt.user.client.rpc.core.java.util.Map_CustomFieldSerializerBase.serialize(Map_CustomFieldSerializerBase.java:50)
        at com.google.gwt.user.client.rpc.core.java.util.LinkedHashMap_CustomFieldSerializer.serialize(LinkedHashMap_CustomFieldSerializer.java:50)
        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.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.invokeNativeVoid(ModuleSpace.java:284)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
        at com.google.gwt.user.client.rpc.impl.SerializerBase$MethodMap$.serialize$(SerializerBase.java)
        at com.google.gwt.user.client.rpc.impl.SerializerBase.serialize(SerializerBase.java:147)
        at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.serialize(ClientSerializationStreamWriter.java:199)
        at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
        at com.eonegroup.dashboard.client.rpc.SGWTItemService_Proxy.fetch(SGWTItemService_Proxy.java:54)
        at com.eonegroup.dashboard.client.datasource.GWTRPCDataSource.transformRequest(GWTRPCDataSource.java:148)

    #2
    I have the same issue, if i refresh a recordset with a (set of) custom criteria it works under development, but when compiled the parameter value is set to [Object object]

    Comment


      #3
      I really would like to move onto SmartGWT 2.2 but I can't without a fix or explanation of how to work around this.

      Someone please give some guidance.

      Comment


        #4
        i also can confirm this problem.

        A fix or a workaround would be really appreciated.

        Comment


          #5
          It is due to the Date Field. Try to remove the DateRange Editor and you will find back your linearized criterias.

          Other way, load your Object object in a public Criteria(JavaScriptObject jsObj).

          Yes?

          Comment


            #6
            I don't use a DateRange Editor, I assign a value to a criteria attribute and use my 'normal' attribute_map => object translator to get a fillter object

            Code:
            copyValues(request.getCriteria(),filter);
            [Fetch values from server filtered by the filter object]
            
            public static void copyValues(DataClass from, Brand to) {
               to.setBrandId(from.getAttributeAsString("brandId"));
               to.setOemCode(from.getAttributeAsString("oemCode"));
               to.setDescription(from.getAttributeAsString("description"));
               to.setDeleted(from.getAttributeAsBoolean("deleted"));
            }
            What do you mean when you say;
            'load your Object object in a public Criteria(JavaScriptObject jsObj).'

            The issue is that the request.getCriteria() does not contain the attribute value but a object (probably the object {operator=and, _constructor=AdvancedCriteria, criteria=[object Object]})
            And that it only behaves like that after the GWT module is compiled...

            Comment


              #7
              Originally posted by Isomorphic
              That other issue you're reporting comes from using a FormItem that supplies AdvancedCriteria. Most likely, you have the filterEditor enabled with a "date" field. To avoid AdvancedCriteria being generated (assuming here your code cannot handle it), setFilterEditorType() on the "date" field to a DateItem (instead of the default DateRangeItem).
              This is what solved it for me.

              Comment


                #8
                I agree Isomorphic and gilcollins.

                What I mean ?
                Code:
                Criteria c = request.getCriteria();
                Criteria advancedC = new Criteria(c.getCriteria());
                Map criteriaMap = (Map)advancedC.getValues();
                Something like that.

                You have to call :
                Code:
                new Criteria(myObjectJS); //myObjectJS is the Object define in your map by [object Object]

                Comment


                  #9
                  Ok, so the workaround for filtering a dataset like this:
                  Code:
                  listGrid.invalidateCache();
                  Criteria filter= listGrid.getCriteria();
                  filter.setAttribute("oemCode", filterValue);
                  listGrid.fetchData(filter);
                  is

                  Code:
                  Criteria c = listGrid.getCriteria();
                  c.setAttribute("oemCode", filterValue);
                  Criteria advancedC = new Criteria(c.getCriteria());
                  listGrid.fetchData(advancedC );
                  I'll try this.

                  Still don't understand what you mean by
                  new Criteria(myObjectJS); //myObjectJS is the Object define in your map by [object Object]

                  The object defined in my map would be a string object called oemCode

                  Thanks for the help, it's quite a time consuming issue to fix because it only happens in the compiled GWT and not in hosted mode
                  Last edited by meindert; 3 Sep 2010, 01:35.

                  Comment


                    #10
                    Hi all,
                    How can I manually set the criteria on a grid without getting this com.google.gwt.user.client.rpc.SerializationException on the compiled GWT RPC???

                    I now create a seperate Criteria object:
                    Code:
                    destinationCriteria = new Criteria("bmId", filter.getBmId());
                    destinationCriteria.addCriteria("type", DealerGroupType.TYPE_REGION.getCode());
                    and pass this when fetching the data
                    Code:
                    destinationGrid.fetchData(destinationCriteria);
                    Am I doing this wrong?

                    Comment

                    Working...
                    X