Announcement

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

    upgrading from SmartGWT 3.1 to 4.0 (SelectItem)

    Hi,

    I'm upgrading to 4.0 (from 3.1) and I have a problem with SelectItem on fetchData(DSCallback callback)

    the problem back since March 3, changing SelectItem.java

    24 févr. 11:30 130224/src/com/smartgwt/client/widgets/form/fields/SelectItem.java
    3 mars 12:34 130303/src/com/smartgwt/client/widgets/form/fields/SelectItem.java

    diff 130224/src/com/smartgwt/client/widgets/form/fields/SelectItem.java 130303/src/com/smartgwt/client/widgets/form/fields/SelectItem.java
    1074a1075,1081
    > * @see {@link SelectItem#fetchData()}
    > */
    > public void fetchData(DSCallback callback){
    > fetchData(callback,null);
    > }
    >
    > /**
    1601,1614d1607
    <
    <
    < /**
    < * @see SelectItem#fetchData()
    < * @see SelectItem#fetchData(com.smartgwt.client.data.DSCallback, DSRequest)
    < */
    < public native void fetchData(DSCallback callback) /*-{
    < var self = this.@com.smartgwt.client.core.DataClass::getJsObj()();
    < self.fetchData($entry(function (item, dsResponse, data, dsRequest) {
    < var responseJ = @com.smartgwt.client.data.DSResponse::new(Lcom/google/gwt/core/client/JavaScriptObject;)(dsResponse);
    < var requestJ = @com.smartgwt.client.data.DSRequest::new(Lcom/google/gwt/core/client/JavaScriptObject;)(dsRequest);
    < if(callback != null) callback.@com.smartgwt.client.data.DSCallback::execute(Lcom/smartgwt/client/data/DSResponse;Ljava/lang/Object;Lcom/smartgwt/client/data/DSRequest;)(responseJ, data, requestJ);
    < }));
    < }-*/;


    A workaround :

    itemCol = new SelectItem("coloris_article_code") {
    public native void fetchData(DSCallback callback, DSRequest requestProperties) /*-{
    var self = this.@com.smartgwt.client.core.DataClass::getJsObj()();
    self.fetchData(
    $entry( function(item,dsResponse,data,dsRequest) {
    if(callback!=null) callback.@com.smartgwt.client.data.DSCallback::execute(Lcom/smartgwt/client/data/DSResponse;Ljava/lang/Object;Lcom/smartgwt/client/data/DSRequest;)(
    @com.smartgwt.client.data.DSResponse::new(Lcom/google/gwt/core/client/JavaScriptObject;)(dsResponse), data,
    @com.smartgwt.client.data.DSRequest::new(Lcom/google/gwt/core/client/JavaScriptObject;)(dsRequest)
    );
    }), requestProperties == null ? null : requestProperties.@com.smartgwt.client.core.DataClass::getJsObj()());
    }-*/;
    };


    Gwt 2.5.1
    Smartgwt-4.0p (build 2013-07-12)
    Firefox 22 (Dev mode)

    Best Regards,
    Regis

    #2
    What is the problem you're having? What are you trying to work around?

    Comment


      #3
      Code:
          itemCol.fetchData(new DSCallback() {
              public void execute(    DSResponse  response,
                                      Object      rawData,
                                      DSRequest   request     ) { 
                  Record  [] _rec = response.getData();
                  if(_rec != null  && _rec.length > 0) {
                      critere.addCriteria("coloris_article_code",
                          _rec[0].getAttributeAsString(
                              "coloris_article_code"
                          )   
                      );  
                      setGrilleSize(null);
                      if(_rec.length == 1)
                          itemCol.setDisabled(true);
                  }   
              }   
          });
      response.getData() is not populate if I do not add "item" in
      function(item,dsResponse,data,dsRequest)

      Comment


        #4
        You should see a fix to this in tonight's mainline (4.1d) and 4.0p builds.

        Comment


          #5
          Thanks!

          Regards
          Regis Augui

          Comment

          Working...
          X