我根本无法让第二个 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> {{ $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> {{ $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/