Announcement

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

    SelectItem: ClassCastException on setPickListSort

    Hello,

    I get the following exception, when I try to set a PickListSort for a SelectItem:

    Code:
    13:38:11.831 [ERROR] [APP] Uncaught exception escaped
    
    java.lang.ExceptionInInitializerError: null
        at ...
    
    Caused by: java.lang.ClassCastException: Cannot cast com.smartgwt.client.widgets.form.fields.SelectItem to com.smartgwt.client.widgets.BaseWidget
        at java.lang.Class.cast(Class.java:3005)
        at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:163)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:57)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        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.setPickListSort(SelectItem.java)
        at ...
    This seems to be cast within smartGWT:

    Code:
    public native void setPickListSort(SortSpecifier[] sortSpecifiers) /*-{
            var self = this.@com.smartgwt.client.widgets.BaseWidget::getJsObj()(),
                specifiers = @com.smartgwt.client.util.JSOHelper::convertToJavaScriptArray([Ljava/lang/Object;)(sortSpecifiers);
            if (self != null && self.pickList != null) self.pickList.setSort(specifiers);
            else {
                var configJS = this.@com.smartgwt.client.core.DataClass::getAttributeAsJavaScriptObject(Ljava/lang/String;)("pickListProperties");
                if (configJS == null) {
                    configJS = {};
                    this.@com.smartgwt.client.core.DataClass::setAttribute(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)("pickListProperties", configJS);
                }
                configJS.initialSort = specifiers;
            }
        }-*/;
    It seems, that there is a cast implemented in this method, which doesnt fit SelectItem, as it doesnt inherit from com.smartgwt.client.widgets.BaseWidget

    #2
    Sort specifier

    What does your sort specifier instantiation look like?

    Comment


      #3
      Its initialized like this

      Code:
      private SortSpecifier[] sorter = {new SortSpecifier(
      			COLUMN_TO_BE_SORTED,
      			SortDirection.ASCENDING)};
      and used like this during initialization of the SelectItem

      Code:
      sortedSelectItem.setPickListSort(sorter);
      where the ClassCastException is thrown.

      Comment


        #4
        Is there a solution to this problem available or do you recommended a better way than manually sorting the entries?

        Comment


          #5
          This has been fixed in nightly builds for a long time, but if you we're building your own SGWT jars from SVN you would still hit this issue. SVN is now updated with the fix.

          Comment

          Working...
          X