'easyui two combo boxes dynamic data load

   columns:[[  
            {field:'limitid',title:'Limit ID',width:250,sortable:'true',  
                formatter:function(value){  
                    for(var i=0; i<limitidlist.length; i++){
                       if (limitidlist[i].limitid == value) return limitidlist[i].name;
                    }
                    return value;  
                },  
                editor:{  
                    type:'combobox',
                        options:{
                        valueField:'limitid',
                        textField:'name',
                        data:limitidlist,
                        required:true ,
                              $('#outstanding_currency').combobox('setValue', 'LKR');    
                            }
                        } 
                }  
            },  

{field:'outstanding_currency',title:'Outstanding Currency',width:150,  
    formatter:function(value){  
        for(var i=0; i<currencylist.length; i++){
if (currencylist[i].currency == value) return currencylist[i].name;
        }
        return value; 
    },  
    editor:{  
        type:'combobox',
options:{
valueField:'currency',
textField:'name',
data:currencylist,
required:true
} 
    }  
},  

actually this is what i need

when someone is selecting 'limitid' i want to show 'outstanding_currency' selected like 'LKR', 'AUS' etc the given solution is not work for this



Solution 1:[1]

try this,

Initailize your combobox.

$('#combo2').combobox({
     //your stuff
}); 

$('#combo1').combobox({  
   //ur stuff,
   onSelect:function(record){ 
      $('#combo2').combobox('setValue', record.id); //the value id of combo 1 which is equal to the id of combo 2
   }
});  

here is the documentaiotn about combobox methods, http://jeasyui.com/documentation/index.php#

UPDATED

if such is the case thn u can use onselect in editor's option

editor:{  
            type:'combobox',
            options:{
                    valueField:'limitid',
                    textField:'name',
                    data:limitidlist,
                    required:true ,
                    onSelect:function(record){ 
                         $('#outstanding_currency').combobox('setValue', record.limitid); 
                        }   
                 }
        } 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1