javascript - 具有嵌套表问题的表排序器?

标签 javascript tablesorter

在提到的 fiddle 中http://jsfiddle.net/P2DsY/标题是制造型号。 这两个有子数据。我需要对我想要排序的唯一父 header 进行排序,而不是对所有子级和父级进行排序 1)输出:

**Make     Model**
Honda   Accord
Honda 2-Door    Honda Red
Honda 4-Door    Honda Blue
Toyota  Camry
Toyota 2-Door   Toyota Yellow
Toyota 4-Door   Toyota Green

如果再次使用 make 排序需要显示如下输出 2)输出:

    **Make   Model**   
    Toyota  Camry
    Toyota 2-Door   Toyota Yellow
    Toyota 4-Door   Toyota Green
    Honda   Accord
    Honda 2-Door    Honda Red
    Honda 4-Door    Honda Blue

请告诉我如何对表格进行排序,而不是对所有表格进行排序,需要根据父内容进行排序..

最佳答案

演示中的问题是“expand-child”不是子行的默认类名。

我已经updated the demo使用以下脚本:

$(document).ready(function() 
{ 
    $("table").tablesorter({
        theme: 'blue',
        cssChildRow: 'expand-child',
        // the following isn't necessary, but I left it there...
        selectorHeaders: '> thead > tr > th'
    }); 
});

关于javascript - 具有嵌套表问题的表排序器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22859995/

相关文章:

javascript - HTML 中的交叉合并表列和行

javascript - react-table/react-table.css 导致测试在编译时崩溃

javascript - 显示 : none changes to display: inline by itself?

javascript - 表单提交刷新页面,不提交

javascript - 下拉菜单不显示

javascript - 在单元格中使用 jQuery Tablesorter 和 div 不起作用

jquery - 如何使用 Jquery 按表格子标题排序

jQuery Tablesorter - 对字母数字列进行排序

javascript - 表排序器和搜索

jquery - 在 intitalsortorder 中使用日期格式时出现 Tablesorter 排序问题