combotree :

      设置为多选框: $('#menu-combotree').combotree({multiple:true}).combotree('loadData', menuListJson).combotree('setValues', moduleMenuIds);

<select >http://www.oschina.net/code/snippet_12_4021

 

<script type="text/javascript" src="./Public/js/jquery.js"></script>
  <link type="text/css" rel="stylesheet" href="./Public/js/EasyUI/css/icon.css" />
  <link type="text/css" rel="stylesheet" href="./Public/js/EasyUI/css/easyui.css" />
  <script type="text/javascript" src="./Public/js/EasyUI/jquery.easyui.min.js"></script>

<select ></select>

$(document).ready(function(){
   var AllList = <?php echo $pluginListJson;?>;
   var defaultIds = <?php echo $entPluginIds;?>;
   $('#module-combotree').combotree({multiple:true}).combotree('loadData', AllList).combotree('setValues',defaultIds);

   var url = "<?php echo url('EntPluginManager', 'update');?>";
   var href = "<?php echo url('EntPluginManager', 'index');?>";
   $('#submit').click(function (){
    var id = $.trim($('#id').val());
    var ids = $('#module-combotree').combotree("getValues");
    var params = {
        id:id,
        ids:ids,
     };
    submit_operate(url,params,href);
   });

});

if ($ent) {
   $pluginAllList = $this->model->getPluginListCombotree();
   $entPluginList = $this->model->getEntPluginIdsByEntId($id);
  }
  $this->assign('pluginListJson', json_encode($pluginAllList));
  $this->assign('entPluginIds', json_encode($entPluginList));

/**
  * 获取企业插件列表Combotree数据
  * @return array
  */
 public function getPluginListCombotree()
 {
  $list = array();
  $PluginList = $this->getList();
  if ($PluginList) {
   foreach ($PluginList as  $k => $v) {
    $list[] = array(
      'id'   => $v['plugin_id'],
      'text' => $v['plugin_name']
    );
   }
  }
  return $list;
 }
 /**
  * 获取企业插件ID集合
  * @param int $ent_id
  * @return array
  */
 public function getEntPluginIdsByEntId($ent_id)
 {
  $sql = "SELECT plugin_id FROM `wx_ent_plugins` WHERE ent_id = %d";
  try {
   return $this->dbBase->getCol(sprintf($sql, $ent_id));
  } catch ( Exception $e ) {
   Logger::error(__FILE__ . '  ' . __CLASS__ . '  ' . __METHOD__ . '  ' . __LINE__ . '  ',
   $e->getMessage() . "\n" . $e->getTraceAsString());
   return false;
  }
 }

 

 

相关文章:

  • 2022-12-23
  • 2021-07-11
  • 2021-10-08
  • 2021-12-20
  • 2021-08-01
  • 2022-02-08
  • 2021-12-05
猜你喜欢
  • 2021-05-24
  • 2021-06-23
  • 2021-10-25
  • 2022-12-23
  • 2021-05-05
  • 2022-12-23
相关资源
相似解决方案