修改EasyUi的combo的radiobutton为checkbox

js:

            $('#cc').combo({
                required: true,
                editable: false,
                multiple: true
            });
            $('#sp').appendTo($('#cc').combo('panel'));
            $('#sp input').click(function () {
                //判断单击的这个checkbox是否被选中,如果是
                if ($(this).is(":checked")) {
                    var v = $(this).val();
                    var s = $(this).next('span').text();
                    var cc = $("#cc");
                    v = v + ',' + cc.combo("getValue");
                    s = s + ',' + cc.combo("getText");
                    $('#cc').combo('setValue', v).combo('setText', s).combo('hidePanel');
                } else {
                    //如果否,就从中删除其,Text和val
                    var dv = $(this).val() + ",undefined";
                    var dt = $(this).next('span').text() + ",";
                    var zv = $('#cc').combo('getValues');
                    var zt = $('#cc').combo('getText');
                    for (var i = 0; i < zv.length; i++) {
                        if (zv[i] == dv) {
                            zv.splice(i, 1);
                        }
                    }
                    zt = zt.replace(dt, "");
                    $('#cc').combo('setValue', zv).combo('setText', zt).combo('hidePanel');
                }
            });

html:

-

你可能感兴趣的:(Jquery)