easyUI下拉框使用

<td style="width:8%;text-align: right;"><label for="province">区县:</label></td>
<td style="width: 17%"><input class="easyui-combobox" type="text" id="qx" name="qx"></input></td>
<td style="width:8%;text-align: right;"><label for="province">因子:</label></td>
<td style="width: 17%"><input id="yz" name="yz" class="easyui-combobox"></td>
$(document).ready(function () {
    //加载因子
    var yz_ = [{ id: 'pm25', text: "PM2.5", "selected": true }, { id: 'pm10', text: "PM10" }, { id: 'o3', text: "O3" },
    { id: 'so2', text: "SO2" }, { id: 'no2', text: "NO2" }, { id: 'co', text: "CO" }
    ];
    combobox_checkbox('yz', yz_, 'auto');
    initSelect();
    //基于准备好的dom,初始化echarts实例
    // myChart = initChart();
    //给options赋值
    // options = initOptions();
    //	  初始化数据

    search();
});
function initSelect() {
    //加载省、市、县下来列表
    // zkyt.comboboxThree($("#sf"), $("#ds"), $("#qx"), user.sssf, user.sscs, user.ssqx);
    /*var sf=$("#sf").val();
    if(sf!=""){
        $("#sf").combobox("readonly",true);
    }
    var ds=$("#ds").val();
    if(ds!=""){
        $("#ds").combobox("readonly",true);
    }
    var qx=$("#qx").val();
    if(qx!=""){
        $("#qx").combobox("readonly",true);
    }
*/
    $("#startTime").datebox('setValue', setDate(new Date(), true));
    $("#endTime").datebox('setValue', setDate(new Date(), false));

}
//加载下拉框复选框
function combobox_checkbox(_id, optionsJson, hight) {
    $('#' + _id).combobox({
        data: optionsJson,
        valueField: 'id',
        textField: 'text',
        //panelHeight: hight,
        // 需要多选则将false改为true
        multiple: false,
        // editable: false,
        formatter: function (row) {
            var opts = $(this).combobox('options');
            return '<input type="checkbox" class="combobox-checkbox">' + row[opts.textField]
        },
        onSelect: function (row) { //选中一个选项时调用
            var opts = $(this).combobox('options');
            //设置选中值所对应的复选框为选中状态
            var el = opts.finder.getEl(this, row[opts.valueField]);
            el.find('input.combobox-checkbox')._propAttr('checked', true);
        },
        onUnselect: function (row) {//不选中一个选项时调用
            var opts = $(this).combobox('options');
            //获取选中的值的values
            $("#point").val($(this).combobox('getValues'));
            //当取消全选勾中时,则取消所有的勾选

            var el = opts.finder.getEl(this, row[opts.valueField]);
            el.find('input.combobox-checkbox')._propAttr('checked', false);
        }
    })
};
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值