Я использую JQuery Bootstrap -таблицу для группировки данных. найдено здесь: https://examples.bootstrap-table.com/#extensions / group-v2. html. Приведенный здесь пример в настоящее время показывает дополнительную строку (не найденную в JSON), но не создает значки или функциональные возможности разворачивания-свертывания.
Я что-то упустил? это код, который я использую в файле HTML:
<link href="../lib/bootstrap-table/src/extensions/group-by-v2/bootstrap-table-group-by.css" rel="stylesheet"/>
<link href="../lib/bootstrap-table/src/bootstrap-table.css" rel="stylesheet"/>
<link href="../lib/bootstrap-table/src/extensions/filter-control/bootstrap-table-filter-control.css" rel="stylesheet"/>
<link rel="stylesheet" href="../lib/bootstrap4-editable/css/bootstrap-editable.css">
...
<script type="text/javascript" src="../util/bootstrap-table.js"></script>
<script src="../lib/bootstrap-table/src/extensions/editable/bootstrap-table-editable.js"></script>
<script src="../lib/bootstrap-table/src/extensions/filter-control/bootstrap-table-filter-control.js"></script>
<script src="../lib/bootstrap-table/src/extensions/group-by-v2/bootstrap-table-group-by.js"></script>
... Далее в файле HTML.
<table id="summGrid" data-toolbar="#summToolbar" data-search="true" data-show-refresh="true" data-show-toggle="true"
data-show-fullscreen="true" data-show-columns="true" data-detail-view="false" data-show-export="true" data-click-to-select="true"
data-group-by="true" data-group-by-field="shape" data-url="./tree.json"
data-pagination="true" data-filter-control="true" data-show-footer="true" data-unique-id="id" data-id-field="id">
<thead>
<tr>
<th data-field="shape">Shape</th>
<th data-field="color">Color</th>
<th data-field="area">Area</th>
</tr>
</thead>
</table>
Json (дерево. json) выглядит так:
[
{
"id": 1,
"shape": "triangle",
"color": "red",
"area": 5,
"label": "T1"
},
{
"id": 2,
"shape": "triangle",
"color": "green",
"area": 27,
"label": "T2"
},
...
Я скопировал и вставил все это из примера, приведенного в ссылке выше.