combobox中onChange在EasyUI中的实现方式应用
<select id="AddShowType" required="true" class="easyui-combobox"> <option value="2">aaa</option> <option value="1">bbb</option> <option value="3">ccc</option> </select>
正常使用jquery绑定这个select
$('#AddShowType').change(function () {
//Do SomeThing
});
但这么绑定easyui的combobox会发现没有效果。根据官方的文档可以知道
Events
The events extend from combo, below is the added events for combobox.
| Name | Parameters | Description |
|---|---|---|
| onBeforeLoad | param | Fires before a request is made to load data, return false to cancel this load action.
Code example: // change the http request parameters before load data from server
$('#cc').combobox({
onBeforeLoad: function(param){
param.id = 2;
param.language = 'js';
}
});
|
| onLoadSuccess | none | Fires when remote data is loaded successfully. |
| onLoadError | none | Fires when remote data load error. |
| onSelect | record | Fires when user select a list item. |
| onUnselect | record | Fires when user unselect a list item. |
正确的绑定方式应该是:
$(document).ready(function () {
$('#AddShowType').combobox({
onSelect: function (record) {
// record.value
// record.text
// record.selected
}
});
})

浙公网安备 33010602011771号