easyui两个组合框动态数据加载

时间:2012-12-18 05:03:50

标签: jquery-easyui

   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
} 
    }  
},  

实际上这就是我需要的东西

当某人选择“有限”时,我想显示“杰出货币”,例如“LKR”,“AUS”等等,给定的解决方案不适用于此

1 个答案:

答案 0 :(得分:0)

试试这个,

宣传您的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
   }
});  

这里是关于组合框方法的文档, http://jeasyui.com/documentation/index.php#

<强>已更新

如果是这种情况,您可以在编辑器选项中使用onselect

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