1. 程式人生 > >easyui combobox 複選框多選

easyui combobox 複選框多選

$('#budgetIdstr').combobox({
  valueField:'id',
       textField:'orgName',
      editable:false,
      multiple:true,
      separator:';',
//       panelWidth:'auto',
      formatter:function(row){  
        var opts;
        if(row.selected==true){
        opts = "<input style='width:15px;height:15px;vertical-align:middle;' type='checkbox' checked='checked' lass='combobox-checkbox' id='"+row.id+"' value='"+row.id+"'>"+row.orgName+"</input>";
        }else{
        opts = "<input  style='width:15px;height:15px;vertical-align:middle;' type='checkbox' id='"+row.id+"' value='"+row.id+"'>"+row.orgName+"</input>";
        }
        return opts;
      },
     url:sname+'/BudgetinfoController/loadBudgetDetails',
      loadFilter: function (rows) {
    return rows;
       },onSelect:function(rec) {
          oCheckbox = document.getElementById(rec.id);   
         oCheckbox.checked=true;
     },onUnselect:function(rec){
     oCheckbox = document.getElementById(rec.id);   
     oCheckbox.checked=false;
     },onShowPanel:function(){
      $(this).combobox('panel').width("auto");
      }

    })