如何从orgChart中的框删除标题

时间:2019-04-10 10:52:16

标签: javascript jquery orgchart

如何从box删除标题,我只希望显示内容。

我搜索了很多,但没有找到任何解决方案。

我正在使用 orgChart https://github.com/dabeng/OrgChart

对于 eg general manager的框将没有标题 Lao Lao

这是演示:https://codepen.io/dabeng/pen/zBNbqV

'use strict';

(function($){

  $(function() {

    var datascource = {
      'name': 'Lao Lao',
      'title': 'general manager',
      'children': [
        { 'name': 'Bo Miao', 'title': 'department manager', 'className': 'middle-level',
          'children': [
            { 'name': 'Li Jing', 'title': 'senior engineer', 'className': 'product-dept' },
            { 'name': 'Li Xin', 'title': 'senior engineer', 'className': 'product-dept',
              'children': [
                { 'name': 'To To', 'title': 'engineer', 'className': 'pipeline1' },
                { 'name': 'Fei Fei', 'title': 'engineer', 'className': 'pipeline1' },
                { 'name': 'Xuan Xuan', 'title': 'engineer', 'className': 'pipeline1' }
              ]
            }
          ]
        },
        { 'name': 'Su Miao', 'title': 'department manager', 'className': 'middle-level',
          'children': [
            { 'name': 'Pang Pang', 'title': 'senior engineer', 'className': 'rd-dept' },
            { 'name': 'Hei Hei', 'title': 'senior engineer', 'className': 'rd-dept',
              'children': [
                { 'name': 'Xiang Xiang', 'title': 'UE engineer', 'className': 'frontend1' },
                { 'name': 'Dan Dan', 'title': 'engineer', 'className': 'frontend1' },
                { 'name': 'Zai Zai', 'title': 'engineer', 'className': 'frontend1' }
              ]
            }
          ]
        }
      ]
    };

    var oc = $('#chart-container').orgchart({
      'data' : datascource,
      'nodeContent': 'title'
    });

  });

})(jQuery);
#chart-container {
  font-family: Arial;
  height: 420px;
  border: 2px dashed #aaa;
  border-radius: 5px;
  overflow: auto;
  text-align: center;
}

.orgchart {
  background: #fff; 
}
.orgchart td.left, .orgchart td.right, .orgchart td.top {
  border-color: #aaa;
}
.orgchart td>.down {
  background-color: #aaa;
}
.orgchart .middle-level .title {
  background-color: #006699;
}
.orgchart .middle-level .content {
  border-color: #006699;
}
.orgchart .product-dept .title {
  background-color: #009933;
}
.orgchart .product-dept .content {
  border-color: #009933;
}
.orgchart .rd-dept .title {
  background-color: #993366;
}
.orgchart .rd-dept .content {
  border-color: #993366;
}
.orgchart .pipeline1 .title {
  background-color: #996633;
}
.orgchart .pipeline1 .content {
  border-color: #996633;
}
.orgchart .frontend1 .title {
  background-color: #cc0066;
}
.orgchart .frontend1 .content {
  border-color: #cc0066;
}

#github-link {
  position: fixed;
  top: 0px;
  right: 10px;
  font-size: 3em;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/orgchart/2.1.3/js/jquery.orgchart.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/orgchart/2.1.3/css/jquery.orgchart.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div id="chart-container"></div>

3 个答案:

答案 0 :(得分:1)

您可以采用上述解决方案-我想您可能希望使用这些符号代替标题。

此代码将仅删除标题。

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table data-row-style="rowStyle" class="table table-bordered table-hover thead-dark thead-inverse">
	<thead>
	<tr>
		<th scope="col" style="width: 8%" class="text-center">Number</th>
		<th scope="col" style="width: 20%" class="text-center">Name</th>
		<th scope="col" style="width: 61%" class="text-center">Present</th>
		<th scope="col" style="width: 10%" class="text-center">Result</th>
	</tr>
	</thead>
	<tr>
		<td class="text-center">01</td>
		<td class="text-center">$title01</td>
		<td>$present01</td>
		<td scope="row" class="text-center">GOOD</td>
	</tr>
	<tr>
		<td class="text-center">02</td>
		<td class="text-center">$title02</td>
		<td>$present02</td>
		<td scope="row" class="text-center">BAD</td>
	</tr>
	<tr>
		<td class="text-center">03</td>
		<td class="text-center">$title03</td>
		<td>$present03</td>
		<td scope="row" class="text-center">GOOD</td>
	</tr>
  </table>

答案 1 :(得分:0)

使用jQuery:

$(".title").hide();

OR

$(".title").css("display", "none");

使用CSS:

.title {
  display: none;
}

答案 2 :(得分:0)

font-size怎么样?

.title {
    font-size: 0 !important;
}

或者您可以这样做:

.title {
  color: transparent !important;
}