用客户端HTML表格排序对行进行分组 [英] Grouping Rows with Client Side HTML Table Sorting

查看:247
本文介绍了用客户端HTML表格排序对行进行分组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在任何现有的表排序库,或者是否可以配置表排序器来对每两个表进行排序行?另外,还有一种更好的方法来语义表达我的表,以便可以进行标准的行排序.

Are there any existing table sorting libraries, or is there a way to configure tablesorter, to sort every two rows? Alternatly, is there a better way to semantially express my table such that standard row sorting will work.

我有一个看起来像这样的html表

I have an html table that looks something like this

<table>
    <thead>
        <tr>
            <th>Header 1</th>
            <th>Header 2</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Some Data: 1</td>
            <td>Some More Data:1 </td>
        </tr>
        <tr>
            <td colspan="2">Some text about the above data that puts it in context and visually spans under both of the cells above so as not to create a weird looking table</td>
        </tr>

        <tr>
            <td>Some Data: 2</td>
            <td>Some More Data: 2</td>
        </tr>
        <tr>
            <td colspan="2">Some text about the above data 2 set that puts it in context and visually spans under both of the cells above so as not to create a weird looking table</td>
        </tr>           

    </tbody>
</table>

我正在寻找一种对表进行排序的方法,以使该表按数据行进行排序,但是带有colspan的行随其数据一起移动,而不是单独进行排序.

I'm looking for a way to sort the table such that the table is sorted by the data rows, but the row with the colspan travels with its data and is not sorted separately.

推荐答案

有人为表排序程序开发了此功能.检出此页面:

Someone developed this functionality for tablesorter. Check out this page:

http://blog.pengoworks.com/index.cfm/2008/3/28/Finished-jQuery-Tablesorter-mod-for-Collapsible-Table-Rows

您需要做的就是为辅助行提供一个"expand-child"类(这是可配置的).

All you need to do is give secondary rows a class of "expand-child" (this is configurable).

完全满足您的需求.

这篇关于用客户端HTML表格排序对行进行分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆