jquery - Tablesorter 插件未对第二个 TBody 进行排序

标签 jquery tablesorter

我根本无法让第二个 TBody 排序,我做错了什么?第一个 tbody 工作正常,但第二个 tbody 不执行任何操作。如果那行不通,我知道应该行得通。然后我需要排序选项始终按类型排序,然后按用户选择的任何选项排序。有点像按然后排序的一组。

enter code here<table id="response-table" width="100%" cellpadding="1" cellspacing="1" class="tablesorter table">
                                <thead>
                                <tr style="border-bottom: thin solid black;">
                                    <th>Name</th>
                                    <th>Date modified</th>
                                    <th>Type</th>
                                    <th>Size</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach ( $folders as $folder)
                                    <tr class="document folder"  id="{{ $folder['id'] }}" style="border: none;">
                                        <td class="no-borders" width="60%"><i class="fa fa-folder text-warning"></i>&nbsp;{{ $folder['name'] }}</td>
                                        <td class="no-borders"><small>{{ date_format(date_create($folder['updated_at'])," m/d/Y  h:i a") }}</small></td>
                                        <td class="no-borders"><small>File folder</small></td>
                                        <td class="no-borders"></td>
                                    </tr>
                                @endforeach
                                </tbody>
                                <tbody>
                                @foreach ( $files as $file)
                                    <tr class="document file"  id="{{ $file['id'] }}" style="border: none;">
                                        <td class="no-borders" width="60%"><i class="fa fa-file text-primary"></i>&nbsp;{{ $file['name'] }}</td>
                                        <td class="no-borders"><small>{{ date_format(date_create($file['updated_at'])," m/d/Y  h:i a") }}</small></td>
                                        <td class="no-borders"><small>{{ $file['extension'] }}</small></td>
                                        <td class="no-borders">{{ $file['bytes'] }}</td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>

最佳答案

如果您使用的是tablesorter.com 的原始tablesorter (v2.0.5),它仅支持第一个tbody ( demo ) 的排序。

要让 tablesorter 对多个 tbody 进行排序,您需要切换到我的 fork of tablesorter -here is a demo .

$(function() {

  $("table").tablesorter({
    theme : 'blue',
    // class name added to tbodies where the content is ignored
    cssInfoBlock : "tablesorter-no-sort"
  });

});

关于jquery - Tablesorter 插件未对第二个 TBody 进行排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35007863/

相关文章:

javascript - 如何使用 JQUERY 在 IF 中添加另一条语句

javascript - 使用动态配置选项动态加载 highcharts

javascript - 更新时缺少模板 Rails

javascript - 在选择框更改时按升序和降序对 HTML 表格进行排序

jquery tablesorter如何忽略排序中的一行

javascript - 隐藏列时的html colspan问题

javascript - 在 jQuery 中,将数字格式化为小数点后两位的最佳方式是什么?

javascript - 如何将文本添加到图像 anchor ?

javascript - JQuery 表排序器不适用于日期范围字符串

php - 使用逗号分隔符的表排序不起作用