我正在使用以下jQuery tablesorter:https ://mottie.github.io/tablesorter/docs/index.html 。我像这样初始化排序:
$('.sortable').tablesorter();
我的桌子看起来像这样:
<table class="sortable" id="list-users">
<thead>
<tr>
<th>
<div class="sorter"></div>
ID
</th>
<th>
<div class="sorter"></div>
Name
</th>
<th>
<div class="sorter"></div>
Birth date
</th>
</tr>
</thead>
<tbody>
<tr>
...
默认行为如下:当我单击th标记时,表格将根据列进行排序。那很好。
但是我想在单击div.sorter时触发事件。有人知道怎么做吗?我尝试了这个:
$('table').find('th:eq(columnNumber)').trigger('sort');
但这当然不会禁用默认事件,当您想要从thead中触发事件时,这很有用。
谢谢!
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句