Javascript 使用jquery对包含子项的HTML表进行排序
我有下面的表结构。我想通过拖放对其进行排序。请注意,我希望根页面具有子页面。我使用的是带有层次结构的列表,但这使得传统浏览器的样式设置变得不可能Javascript 使用jquery对包含子项的HTML表进行排序,javascript,jquery,sorting,html-table,hierarchy,Javascript,Jquery,Sorting,Html Table,Hierarchy,我有下面的表结构。我想通过拖放对其进行排序。请注意,我希望根页面具有子页面。我使用的是带有层次结构的列表,但这使得传统浏览器的样式设置变得不可能 <table> <tr data-id="1"> <td>Page name</td> <td>Other column</td> </tr> <tr data-id="2"> <td>
<table>
<tr data-id="1">
<td>Page name</td>
<td>Other column</td>
</tr>
<tr data-id="2">
<td>Page name</td>
<td>Other column</td>
</tr>
<tr class="children" data-parent="2">
<table>
<tr data-id="3">
<td>Page name</td>
<td>Other column</td>
</tr>
<tr data-id="4">
<td>Page name</td>
<td>Other column</td>
</tr>
</table>
</tr>
</table>
页面名称
其他栏目
页面名称
其他栏目
页面名称
其他栏目
页面名称
其他栏目
你写过JavaScript吗,或者你只是要求别人帮你写?我相信你不能用表来写。如果在列表(“li”)元素中渲染它,则可以。使用jqueryli,您可以开始构建它:所以您已经尝试过了。显示您的努力。我已经用(“li”)元素完成了,但是当您这样做时,您不会得到表样式的css(根据内容调整大小的列和一行中固定宽度的列)。