1. 程式人生 > >easyui 綁定下拉框,下拉框選擇改變事件的觸發方法

easyui 綁定下拉框,下拉框選擇改變事件的觸發方法

height mbo options ble data 方法 cte com ear

//①定義下拉框
 //離線公司【個人或公司】 下拉框
    var tmpComOrPer = {
        type: ‘combobox‘,
        options: {
            onSelect:function(data) {
                ComOrPerChange(false);
            },
            editable:false,
            panelHeight: ‘auto‘,
            valueField: ‘Type‘,
            textField: ‘label‘,
            data: [ {
                label: [email protected]
/* */_CTL_087‘, Type: ‘0‘ }, { label: [email protected]_CTL_088‘, Type: ‘1‘ }], required: true } } //②綁定下拉框 。。。。。 { align: ‘center‘, field: ‘ComOrPer‘, title: [email protected]_CTL_127‘, width: 65, editor: tmpComOrPer} 。。。。。。

  

選擇事件

onSelect:function(data) {
ComOrPerChange(false);
},

datagrid 動態綁定下拉框

   function ComOrPerChange(bl) {

        var row =comdg.thisdg.datagrid(‘getSelected‘);
        var rowIndex = comdg.thisdg.datagrid(‘getRowIndex‘,row);//獲取行號
        var target = comdg.thisdg.datagrid(‘getEditor‘, {‘index‘:rowIndex,‘field‘:‘ReportType‘}).target;
        var targetValue = target.combo("getValue");
        target.combobox(‘clear‘); //清除原來的數據

        var targetComOrPer = comdg.thisdg.datagrid(‘getEditor‘, {‘index‘:rowIndex,‘field‘:‘ComOrPer‘}).target;

        if (targetComOrPer.combo("getValue") == "1") {
            target.combobox({data:[ {
                label: [email protected]
/* */_CTL_100‘, Type: ‘12‘ }, { label: [email protected]_CTL_101‘, Type: ‘13‘ }, { label: [email protected]_CTL_102‘, Type: ‘14‘ }]}); } else { target.combobox({data:[ { label: [email protected]_CTL_089‘, Type: ‘0‘ }, { label: [email protected]_CTL_090‘, Type: ‘1‘ }, { label: [email protected]_CTL_091‘, Type: ‘2‘ }, { label: [email protected]_CTL_092‘, Type: ‘3‘ }, { label: [email protected]_CTL_093‘, Type: ‘4‘ }, { label: [email protected]_CTL_094‘, Type: ‘5‘ }, { label: [email protected]_CTL_095‘, Type: ‘6‘ }, { label: [email protected]_CTL_096‘, Type: ‘7‘ }, { label: [email protected]_CTL_097‘, Type: ‘8‘ }, { label: [email protected]_CTL_098‘, Type: ‘9‘ },{ label: [email protected]_CTL_171‘, Type: ‘10‘ }, { label: [email protected]_CTL_099‘, Type: ‘11‘ }@*, { label: [email protected]_CTL_100‘, Type: ‘12‘ }, { label: [email protected]_CTL_101‘, Type: ‘13‘ }, { label: [email protected]_CTL_102‘, Type: ‘14‘ }*@]}); } if(bl) target.combobox("setValue", targetValue); }

  

easyui 綁定下拉框,下拉框選擇改變事件的觸發方法