【发布时间】:2018-03-06 09:21:22
【问题描述】:
我有一个这样构建的树形网格:
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Number</th>
</tr>
</thead>
<tbody>
<tr class="treegrid-0">
<th>name2</th>
<th>type2</th>
<th>Number2</th>
</tr>
<tr class="treegrid-1">
<th>name1</th>
<th>type1</th>
<th>Number1</th>
</tr>
<tr class="treegrid-2 treegrid-parent-1" style="display:none;">
<th>name1-A</th>
<th>type1-A</th>
<th>Number1-A</th>
</tr>
<tr class="treegrid-3 treegrid-parent-1" style="display:none;">
<th>name1-B</th>
<th>type1-B</th>
<th>Number1-B</th>
</tr>
<tr class="treegrid-4">
<th>name0</th>
<th>type0</th>
<th>Number0</th>
</tr>
</tbody>
</table>
我想在单击列时添加排序选项。 排序选项必须仅在顶级父级上完成。 它是一个树形网格,因此预期的行为是,如果父节点必须移动,子节点也必须与父节点一起移动。
我怎样才能用 JS 做到这一点?
【问题讨论】:
标签: javascript jquery treegrid columnsorting