事件列表

事件名 参数 描述
onBeforeSelect (value,text) 选择前事件
onSelected (value,text) 选择事件
onStartResize () 下拉框编辑前事件
onEndResize () 下拉框编辑后事件
onSuccess (data) 加载完事件
onError (XMLHttpRequest, textStatus) 错误事件
onBeforeOpen () 打开前事件

onBeforeSelect事件 示例:

1 var proData = 2 [{ id: 1, text: '广东' }, 3 { id: 2, text: '福建'}]; 4 $("#txtPro").ligerComboBox({ data: proData, isMultiSelect: false, 5 onBeforeSelect: function (newvalue) 6 { 7 alert('要选择的是' + newvalue); 8 return confirm('onBeforeSelect事件可以阻止选择,是否继续'); 9 }, 10 onSelected: function (newvalue) 11 { 12 alert('选择的是' + newvalue); 13 } 14 });

onSelected事件 示例:

1 var proData = 2 [{ id: 1, text: '广东' }, 3 { id: 2, text: '福建'}]; 4 var cityData = 5 [{ id: 1, text: '潮州', pid: 1 }, 6 { id: 2, text: '福州', pid: 1 }, 7 { id: 3, text: '广州', pid: 2 }, 8 { id: 4, text: '厦门', pid: 2}]; 9 $("#pro").ligerComboBox({ 10 data: proData, isMultiSelect: false, 11 onSelected: function (newvalue) 12 { 13 var newData = new Array(); 14 for (i = 0; i < cityData.length; i++) 15 { 16 if (cityData[i].pid == newvalue) 17 { 18 newData.push(cityData[i]); 19 } 20 } 21 liger.get("city").setData(newData); 22 } 23 }); 24 $("#city").ligerComboBox({ data: null, isMultiSelect: true, isShowCheckBox: true });

onBeforeOpen事件 示例:

1 $(function () 2 { 3 $("#txtContactName").ligerComboBox({ 4 onBeforeOpen: f_selectContact, valueFieldID: 'hidCustomerID',width:300 5 }); 6 }); 7 function f_selectContact() 8 { 9 $.ligerDialog.open({ title: '选择联系人', name:'winselector',width: 700, height: 300, url: 'SelectContact.htm', buttons: [ 10 { text: '确定', onclick: f_selectContactOK }, 11 { text: '取消', onclick: f_selectContactCancel } 12 ] 13 }); 14 return false; 15 }