Jquery comboBox使用

    var isolateCols = [{id:1,text:'服务器'},{id:2, text:'真实姓名'}];
    
    // 选择报表时改变列项
    $("#reportForm").change(function() {
        // 清空原选中的数据
        $("#reportCol").combobox('setValues','');
        
        // 填充新的列表项
        var cols = null;

        var itemSel = $(this).children("option:selected").val();
        switch (itemSel) {
            case 'isolate':
                cols = isolateCols;
                break;
        }

        $('#reportCol').combobox('loadData', cols);

        // 默认选中所有列表项
        for (var i = 0; i < cols.length; i++) {
            $('#reportCol').combobox('select', cols[i].id);
        }
    });


你可能感兴趣的:(javascript,JQuery)