我想用jQuery插件TableSorter对我的表进行排序。所以我得到了这个表:
<table id="stats" class="zebra-striped">
<thead>
<tr>
<th>Date</th>
<th>Annonce</th>
<th>Support</th>
<th>Nb Assoc.</th>
<th>Nb Transfo.</th>
<th>Cout</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
所以你可以看到我的表是空的,只有一个标题。所以我用空单元格初始化表排序:
$("table#stats").tablesorter({ sortList: [[0,0]]});
我马上就得到了这个错误:
jquery.tablesorter.min.js:4 Uncaught TypeError: Cannot read property '0' of undefined
仅供参考,这是我的js加载:
<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if necessary -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.5.1.min.js">\x3C/script>')</script>
<script src="js/bootstrap-dropdown.js"></script>
<script src="js/bootstrap-scrollspy.js"></script>
<script src="js/jquery.tablesorter.min.js"></script>
你知道为什么我会得到这个插件,以及怎样才能让插件再次工作吗?
Thx
https://stackoverflow.com/questions/8878945
复制相似问题