EasyuiCombobox三级联动

时间:2023-03-08 16:18:20

有许多刚接触Easyui中Combobox控件的朋友可能都会遇到的问题:如何将Combobox做成三级联动?

现分享一个三级联动的案例给大家参考参考,经测试能通过。注意Combobox绑定的数据是Json格式

 $(function () {
var project1 = $("#project1").combobox({
url: 'Project_Select.ashx?flg=0',
editable: false,
valueField: 'ID',
textField: 'projectname',
editable: false, //不允许手动输入
onSelect: function (record) {
project2.combobox({
disabled: false,
url: 'Project_Select.ashx?flg=' + record.ID,
editable: false,
valueField: 'ID',
textField: 'projectname'
}).combobox('clear');
}
});
var project2 = $("#project2").combobox({
disabled: true,
editable: false,
valueField: 'ID',
textField: 'projectname',
onSelect: function (record) {
project3.combobox({
disabled: false,
url: 'Project_Select.ashx?flg=' + record.ID,
editable: false,
valueField: 'ID',
textField: 'projectname'
}).combobox('clear');
}
});
var project3 = $("#project3").combobox({
disabled: true,
editable: false,
valueField: 'ID',
textField: 'projectname'
});
});