The ComboBox has only a RadioButton effect in the Easyui's base assembly, and only supports single-radio.
But on the basis of this control, we can rewrite the ComboBox to achieve the CheckBox multi-selection effect.
There are a few ways to rewrite the following:
Format:function (Row) {var opts = $ (this). ComboBox ("Options"); Return "<input type= ' checkbox ' class= ' Combobox-checkbox ' >" + Row[opts.textfield];}
Onshowpanel:function () {
var opts = $ (this). ComboBox ("Options"); target = this; var values = $ (target). ComboBox ("GetValues"); $.map (values, function (value) {var children = $ (target). ComboBox ("Panel"). Children (); $.each (children, function (Inde X, obj) {if (value = = Obj.getattribute ("value") && obj.children && obj.children.length > 0) {o Bj.children[0].checked = true;
}}); });}
Onloadsuccess:function () {var opts = $ (this). ComboBox ("Options"); var target = this; var values = $ (target). ComboBox ("GetValues"); $.map (values, function (value) {var children = $ (target). ComboBox ("Panel"). Children (); $.each (children, function (Inde X, obj) {if (value = = Obj.getattribute ("value") && obj.children && obj.children.length > 0) {o Bj.children[0].checked = true;
}}); });}
onselect : function (row) { var opts = $ (this). ComboBox ("Options"); var objcom = null; var children = $ (This). ComboBox ("Panel"). Children (); $.each (Children, function (index, obj) { if (row[opts.valueField] = = obj.getattribute ("value")) { objcom = obj;} }); if (objcom != null && objcom.children && objcom.children.length > 0) { objcom.children[0].checked = true; }}
Onunselect:function (Row) {
var opts = $ (this). ComboBox ("Options"); var objcom = null; var children = $ (this). ComboBox ("Panel"). Children (); $.each (children, function (index, obj) {if (Row[opts.valuefield] = = Obj.getattribute ("value")) {objcom = obj;}
}); if (objcom! = null && objcom.children && objCom.children.length > 0) {objcom.children[0].checked = false; }}
after overriding the above methods, you can implement multiple selections with a checkbox for the ComboBox
On the implementation of multi-selection and additional checkbox for ComboBox in Easyui