开发者

Combobox value not getting selected when form is dynamically loaded

I am making a form which is an edit screen. That means data has to be populated on load of the screen, I am using spring mvc controller to achieve this. All the textbox data getting loaded. But combobox is not selected. Do I need to do anything extra for combobox? Below is the piece of code used for getting data:

Ext.getCmp('ADD_ADDRESS_Panel').getForm().load({
       url: '/omsWeb/order/Addressload.htm?accountid=1223', 
       method: 'GET',
       failure: function(form, action) {
            Ext.Msg.alert("Load failed", action.result.errorMessage);
       }

Thank开发者_开发百科s for the response


For setting a combo box on form load, the combo box's store needs to be loaded first. After the store has loaded, load the form. It will work fine. If it doesn't then the work around would be something like this:

form.getForm().load({
   .. config.. 
   success : function(form, action){
    if(action.result){
      var data = action.result.data;
      var store = combo.getStore();
      store.each(function(record){
        if(record.data.id===data.id){
        cmp.setValue(record.data.id);
         return false;
        }
      });
     }
   }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜