<td width="15%" class="main_form_tabletitle">所属地区:</td> <td width="35%"> <input id="orgCode" name="orgCode" class="easyui-combobox" required=true missingMessage="必填"> </td>
$(function(){ //Initialize the multi-select checkbox (area) initCombobox ('orgCode'); }); function initCombobox(id){ var selectedText = []; //Load the dropdown box checkbox $('#'+id).combobox({ url:'/promotionReward/queryEngineerFixAssignArea.do', //The url to get the drop-down box data in the background method:'post', panelHeight: 200,//Set to a fixed height, a vertical scroll bar appears in the combobox valueField:'deptCode', textField:'deptName', multiple:true, editable:false, formatter: function (row) { //The formatter method is to implement the method of adding a checkbox in front of each drop-down option var opts = $(this).combobox('options'); if($('#deptCode').val().indexOf(row[opts.valueField]) != -1){ selectedText.push(row[opts.valueField]); return '<option selected="selected">' + row[opts.textField] + '</option>'; }else{ return '<option>' + row[opts.textField] + '</option>'; } }, onLoadSuccess: function () { //The drop-down box data is loaded successfully and called $(this).combobox('setValues', selectedText);//fill data }, onSelect: function (row) { //Called when an option is selected $(this).combobox('setValues', $(this).combobox('getValues')); }, onUnselect: function (row) {//Called when an option is not selected } }); }