简体   繁体   中英

reload extjs object after ajax

I am using a star rating plugin with ExtJS that is working well, but I need to reset the displayValue after the click event. I also have a json object with {'rating':'#'} but I cannot figure out how to have ExtJS correlate this value with the Rater's displayValue property. It seems that I set it after the component is already rendered, because I am setting under loadform success.

  rater = new Ext.ux.form.Rater({
        id: rater,
        fieldLabel: 'Contact Rating',
        displayValue:1,
        maxValue:10,
        rate:function(){                                         
           Ext.Ajax.request({
              url: '/pt-app/contacts/updateRating/',
              params:
              {
               contactID:6,
               rateValue: rater.hoverValue
              },
              method: 'POST',
              success: function(result) {
                 rater.displayValue = rater.hoverValue;
              }
          });
       }
  });

   formload:
         success:
              var objResponse = Ext.util.JSON.decode(myResponse.response.responseText);
              rater.displayValue = objResponse.data.rating;

I aspire to get the json value in there prior to the success of the form load (the bottom bit works, just too late), as well as have the component update when it is utilized. thanks much in advance. I feel like I just need to make a method call to the parent container to remove and add (reload?) it, but I can't determine what it is.

~brandon

rater.displayValue() 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM