Tablesorter插件没有排序第二个TBody

时间:2016-01-26 06:03:16

标签: jquery tablesorter

我无法让第二个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>

1 个答案:

答案 0 :(得分:1)

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

要让tablesorter对多个tbodies进行排序,您需要切换到我的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"
  });

});