我目前正在实施dabeng的OrgChart(https://github.com/dabeng/OrgChart),并希望在加载组织结构图时显示父节点并隐藏子节点。
我有以下代码,我假设添加了显示父节点的选项,但是这不起作用:
$.fn.orgchart = function (options) {
var defaultOptions = {
'nodeTitle': 'name',
'nodeUIMID': 'uim_id',
'nodeJobTitle': 'title',
'nodeFaculty': 'faculty',
'nodeDepartment': 'department',
'nodeSubSection': 'sub_section',
'nodeUrl': 'url',
'nodeId': 'id',
'toggleSiblingsResp': false,
'depth': 999,
'chartClass': '',
'exportButton': false,
'exportFilename': 'OrgChart',
'exportFileextension': 'png',
'draggable': false,
'direction': 't2b',
'pan': true,
'zoom': true,
'zoominLimit': 2,
'zoomoutLimit': 0.5,
'showParent': true,
'hideChildren': true
};
switch (options) {
case 'showParent':
return showParent.apply(this, Array.prototype.splice.call(arguments, 1));
case 'hideChildren':
return hideChildren.apply(this, Array.prototype.splice.call(arguments, 1));
default: // initiation time
var opts = $.extend(defaultOptions, options);
}
// build the org-chart
var $chartContainer = this;
var data = opts.data;
var $chart = $('<div>', {
'data': { 'options': opts },
'class': 'orgchart' + (opts.chartClass !== '' ? ' ' + opts.chartClass : '') + (opts.direction !== 't2b' ? ' ' + opts.direction : ''),
'click': function (event) {
if (!$(event.target).closest('.node').length) {
$chart.find('.node.focused').removeClass('focused');
}
}
});
构建图表时是否需要调用showParent函数?
答案 0 :(得分:0)
您可以使用以下代码段:
1 user1 u1@u.com
2 user2 u1@u.com
3 user3 u1@u.com
4 user4 u1@u.com
5 user5 u1@u.com
6 user6 u1@u.com
7 user7 u1@u.com
8 user8 u1@u.com
9 user9 u1@u.com
<table class="table table-striped table-bordered table-hover" id="userlist">
<thead>
<tr>
<th>Name</th>
<th>Email ID</th>
</tr>
</thead>
<tbody>
<?php
foreach ($user_detail as $valuee) { ?>
<tr>
<td><?php echo $valuee['name']; ?></td>
<td><?php echo $valuee['email']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>