1, the project uses to the ComboBox the multi-select value and the related operation, does not say more, directly on the code:
<input id= "Education" name= "Education" class= "Easyui-combobox" data-options= "method: ' Get ', Valuefield: ' ID ', TextField: ' name ',multiple:true, panelheight: ' Auto ', Required:true,url: ' ${ctx} ', Editable:false,value : ' AA ',loadfilter:function (data) {if (null==data) return [];var DD = []; Dd.push ({id: ' AA ', Name: ' Unlimited '}); for (var i=0; i<data.length; i++) {Dd.push (data[i]);} return DD;} " />
Multiple:true----Set ComboBox multiple selection
Value: ' AA ',
Dd.push ({id: ' AA ', Name: ' Unlimited '});------combination to determine the default value
2, ComboBox get multi-select value and JS split string
var education = $ ("#education"). ComboBox ('getValues');//Get multiple selection values
Note: The combobox gets a multiple-selection value for the array. 21, 22, 23
Determines whether to include Aafunction contains (arr) {var i = arr.length-1;//from the array to determine if STR exists while (i--) {if (arr[i] = = = ' AA ') {return true;}} return false;} Remove the contained string function Removestr (arr) {var arrnew = new Array ();//delete the specified strfor from the array (var i = 0; i < arr.length; i++) {if (' AA ')! = Arr[i]) {Arrnew.push (arr[i]);}} return arrnew.tostring ();}
More flexible settings can be passed into different strings for judgment and removal, here is a sample.
Easyui-combobox default settings, get multi-select value and JS include string, delete string