combo参数配置_手册
combotree :
设置为多选框: $('#menu-combotree').combotree({multiple:true}).combotree('loadData', menuListJson).combotree('setValues', moduleMenuIds);
<select id="menu-combotree" name="m_ids[]" style="width: 200px;"></select>
var menuListJson = [{"id":"1","text":"\u57fa\u672c\u7ba1\u7406(---)","parent":"0","children":[{"id":"2","text":"\u7ba1\u7406\u5458\u7ba1\u7406(---)","parent":"1"},{"id":"3","text":"\u4fee\u6539\u5bc6\u7801(---)","parent":"1"},{"id":"4","text":"\u8bbe\u7f6e\u6b22\u8fce\u8bcd(---)","parent":"1"},{"id":"5","text":"\u6743\u9650\u5206\u914d(---)","parent":"1"},{"id":"6","text":"\u4f01\u4e1a\u4fe1\u606f(---)","parent":"1"},{"id":"52","text":"\u63a8\u9001\u8bbe\u7f6e(---)","parent":"1"},{"id":"59","text":"\u5ba2\u670d\u914d\u7f6e(---)","parent":"1"}]},{"id":"7","text":"\u4e00\u7ebf\u5ba2\u670d\u7ba1\u7406(---)","parent":"0","children":[{"id":"8","text":"\u5ba2\u670d\u7ec4\u7ba1\u7406(---)","parent":"7"},{"id":"79","text":"\u5ba2\u6237\u7ec4\u6307\u5b9a\u5ba2\u670d\u7ec4(---)","parent":"7"},{"id":"9","text":"\u5ba2\u670d\u7ba1\u7406(---)","parent":"7"},{"id":"10","text":"\u5b9e\u65f6\u76d1\u63a7(---)","parent":"7"}]},{"id":"11","text":"\u4e8c\u7ebf\u5ba2\u670d\u7ba1\u7406(---)","parent":"0","children":[{"id":"12","text":"\u5ba2\u670d\u7ec4\u7ba1\u7406(---)","parent":"11"},{"id":"13","text":"\u5ba2\u670d\u7ba1\u7406(---)","parent":"11"},{"id":"14","text":"\u5b9e\u65f6\u76d1\u63a7(---)","parent":"11"}]},{"id":"15","text":"\u5ba2\u6237\u7ba1\u7406(---)","parent":"0","children":[{"id":"16","text":"\u5ba2\u6237\u7ec4\u7ba1\u7406(---)","parent":"15"},{"id":"17","text":"\u5ba2\u6237\u7ba1\u7406(---)","parent":"15"}]},{"id":"18","text":"\u6d88\u606f\u7ba1\u7406(---)","parent":"0","children":[{"id":"19","text":"\u4f1a\u8bdd\u5206\u7ec4(---)","parent":"18"},{"id":"20","text":"\u4f1a\u8bdd\u5386\u53f2(---)","parent":"18"}]},{"id":"21","text":"\u63d2\u4ef6\u7ba1\u7406(---)","parent":"0","children":[{"id":"22","text":"\u63d2\u4ef6\u5217\u8868(---)","parent":"21"},{"id":"47","text":"\u5173\u952e\u8bcd\u56de\u590d(---)","parent":"21"},{"id":"48","text":"\u81ea\u5b9a\u4e49\u56de\u590d(---)","parent":"21"},{"id":"49","text":"\u5730\u7406\u4f4d\u7f6e\u56de\u590d(---)","parent":"21"}]},{"id":"23","text":"\u7fa4\u53d1\u7ba1\u7406(---)","parent":"0","children":[{"id":"24","text":"\u7fa4\u53d1\u6d88\u606f(---)","parent":"23"},{"id":"25","text":"\u7fa4\u53d1\u5386\u53f2(---)","parent":"23"},{"id":"77","text":"\u6d88\u8d39\u7ba1\u7406(---)","parent":"23"},{"id":"60","text":"\u6a21\u677f\u7fa4\u53d1(---)","parent":"23"}]},{"id":"26","text":"\u7edf\u8ba1\u62a5\u8868(---)","parent":"0","children":[{"id":"27","text":"\u5ba2\u6237\u7edf\u8ba1(---)","parent":"26"},{"id":"28","text":"\u4f1a\u8bdd\u7edf\u8ba1(---)","parent":"26"},{"id":"29","text":"\u5ba2\u670d\u670d\u52a1\u7edf\u8ba1(---)","parent":"26"},{"id":"53","text":"\u6d88\u606f\u660e\u7ec6(---)","parent":"26"}]},{"id":"30","text":"\u95e8\u5e97\u7ba1\u7406(---)","parent":"0","children":[{"id":"31","text":"\u95e8\u5e97\u7ba1\u7406(---)","parent":"30"},{"id":"32","text":"\u95e8\u5e97\u5206\u914d(---)","parent":"30"},{"id":"41","text":"\u5ba2\u6237\u7ba1\u7406(---)","parent":"30"},{"id":"44","text":"\u7fa4\u53d1\u6d88\u606f(---)","parent":"30"},{"id":"45","text":"\u7fa4\u53d1\u5386\u53f2(---)","parent":"30"},{"id":"46","text":"\u6279\u91cf\u5bfc\u5165(---)","parent":"30"}]},{"id":"36","text":"\u4f1a\u5458\u7ed1\u5b9a(---)","parent":"0","children":[{"id":"37","text":"\u7ed1\u5b9a\u8bbe\u7f6e(---)","parent":"36"},{"id":"61","text":"\u4f1a\u5458\u7ed1\u5b9a\u5217\u8868(---)","parent":"36"}]},{"id":"38","text":"\u7d20\u6750\u7ba1\u7406(---)","parent":"0","children":[{"id":"39","text":"\u56fe\u6587\u7d20\u6750(---)","parent":"38"},{"id":"55","text":"\u56fe\u7247\u7d20\u6750(---)","parent":"38"},{"id":"74","text":"\u8bed\u97f3\u7d20\u6750(---)","parent":"38"},{"id":"75","text":"\u89c6\u9891\u7d20\u6750(---)","parent":"38"},{"id":"76","text":"\u97f3\u4e50\u7d20\u6750(---)","parent":"38"}]},{"id":"42","text":"\u81ea\u5b9a\u4e49\u83dc\u5355(---)","parent":"0","children":[{"id":"43","text":"\u83dc\u5355\u7ba1\u7406(---)","parent":"42"}]},{"id":"50","text":"\u4e8c\u7ef4\u7801\u5e94\u7528(---)","parent":"0","children":[{"id":"51","text":"\u5e94\u7528\u5217\u8868(---)","parent":"50"},{"id":"63","text":"\u4f1a\u5458\u7ed1\u5b9a(---)","parent":"50"},{"id":"64","text":"\u6d3b\u52a8\u63a8\u5e7f(---)","parent":"50"},{"id":"65","text":"\u5546\u54c1\u4e8c\u7ef4\u7801(---)","parent":"50"},{"id":"66","text":"\u95e8\u5e97\u63a8\u5e7f(---)","parent":"50"},{"id":"67","text":"\u4fdd\u4fee\u5361(---)","parent":"50"},{"id":"70","text":"\u81ea\u5b9a\u4e49\u4e8c\u7ef4\u7801(---)","parent":"50"}]},{"id":"58","text":"\u76d1\u6d4b\u7ba1\u7406(---)","parent":"0","children":[{"id":"56","text":"\u6765\u6e90\u5a92\u4f53\u7ba1\u7406(---)","parent":"58"},{"id":"57","text":"\u7f51\u9875\u76d1\u6d4b\u7ba1\u7406(---)","parent":"58"},{"id":"68","text":"\u7f51\u9875\u76d1\u6d4b\u62a5\u8868(---)","parent":"58"},{"id":"62","text":"\u6d3b\u52a8\u76d1\u6d4b\u7ba1\u7406(---)","parent":"58"},{"id":"69","text":"\u6d3b\u52a8\u76d1\u6d4b\u62a5\u8868(---)","parent":"58"}]},{"id":"71","text":"IVR\u7ba1\u7406(---)","parent":"0","children":[{"id":"72","text":"IVR\u83dc\u5355\u7ba1\u7406(---)","parent":"71"},{"id":"73","text":"\u4e1a\u52a1\u6d41\u7a0b\u7ba1\u7406(---)","parent":"71"},{"id":"78","text":"\u4e1a\u52a1\u6d41\u7a0b\u660e\u7ec6(---)","parent":"71"}]},{"id":"33","text":"\u67e5\u770b\u8bb0\u5f55(---)","parent":"0"},{"id":"34","text":"\u8f6c\u4e8c\u7ebf\u5ba2\u670d(---)","parent":"0"},{"id":"35","text":"\u5ba2\u6237\u5206\u7ec4(---)","parent":"0"}];
var moduleMenuIds = ["2","3","4","5","6","16","17","56","57","62","68","69"];
$('#menu-combotree').combotree({multiple:true}).combotree('loadData', menuListJson).combotree('setValues', moduleMenuIds);
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 id="module-combotree" name="mod_ids[]" style="width: 200px;"></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;
}
}
posted on 2013-10-08 15:23 andydaopeng 阅读(561) 评论(0) 编辑 收藏 举报