new*_*bie 6 jquery tablesorter jquery-ui jquery-plugins
我可以忽略jquery tablesorting插件中特定列的排序吗?
所以基本上当页面加载时我不希望在"搜索"列上进行任何排序,因为它包含图像并进行自己的一些javascript处理,这大大减慢了我的排序.
这是我的代码:
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("table").tablesorter({
});
Run Code Online (Sandbox Code Playgroud)
});
puts "<table cellspacing=\"1px\" class=\"tablesorter\" >"
puts "<thead>"
puts "<tr>"
puts "<th>Search</th>"
puts "<th>Sub-App</th>"
puts "<th>Division</th>"
puts "<th>Region</th>"
puts "<th>Market</th>"
puts "<th>Language</th>"
puts "<th>Function</th>"
puts "<th>LOB</th>"
puts "<th>Term</th>"
puts "<th>Center</th>"
puts "</tr>"
puts "</thead>"
puts "<tbody>"
puts "<tr>"
puts "<td id=\"$cellID\">"
puts "<img src=\"images/magnifier.gif\" style=\"cursor:pointer\" onclick=\"showRouting({'spec':'${specific}', 'id':'${mkt_id}', 'name':'${mkt_name}', 'xfer':'${xfertype}', 'cell':'${cellID}'})\"</img>"
puts "</td>"
puts "<td>$level</td>"
puts "<td>$div_name</td>"
puts "<td>$reg_name</td>"
puts "<td>$link</td>"
puts "<td>$lang</td>"
puts "<td>$func</td>"
puts "<td>$lob</td>"
puts "<td>$term</td>"
puts "<td>$ctr_name</td>"
puts "</tr>"
puts "</tbody>"
puts "</table>"
Run Code Online (Sandbox Code Playgroud)
没关系.以下回答我的问题.它没有更快排序,因为它仍然显示该列上的图像.
headers: {
0: { sorter: false }
}
Run Code Online (Sandbox Code Playgroud)
将noSort类添加到</td>您不希望排序的列的标题中,然后添加到以下内容:
$(document).ready(function() {
// Get Headers with Class noSort //
var theHeaders = {}
$(this).find('th.noSort').each(function(i,el){
theHeaders[$(this).index()] = { sorter: false };
});
// Initialize Table Sorter //
$("table").tablesorter({
headers: theHeaders
});
});
Run Code Online (Sandbox Code Playgroud)
我希望这有帮助!
| 归档时间: |
|
| 查看次数: |
7474 次 |
| 最近记录: |