1
好了,我看可以在文档上的入门例子:http://mottie.github.io/tablesorter/docs/index.html#Demo为什么不能正确加载?
我尝试做文档中提供的基本的例子,但是我的表不符合的tablesorter功能加载(即标题上的排序图标或可点击的标题列),如在线版本所示。我做错了什么?...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Something</title>
<!-- load tableSorter theme -->
<link href="http://mottie.github.io/tablesorter/css/theme.default.css" rel="stylesheet">
<!-- load jQuery and tableSorter scripts -->
<script type="text/javascript" src="./includes//jquery-2.1.0.js"></script>
<script type="text/javascript" src="./includes/tablesorter-master/js/jquery.tablesorter.js"></script>
<!-- load tableSorter widgets -->
<script type="text/javascript" src="./includes/tablesorter-master/js/jquery.tablesorter.widgets.js"></script>
<script type="text/javascropt">
$(document).ready(function(){
$("table").tablesorter({
theme : 'blue',
widgets : ['zebra','columns'],
sortList: [[0,0]],
debug : true,
widthFixed: false,
showProcessing : true
});
});
</script>
</head>
<body>
<table class="tablesorter">
<thead>
<tr>
<th>Last Name</th>
<th>First Name</th>
<th>Email</th>
<th>Due</th>
<th>Web Site</th>
</tr>
</thead>
<tbody>
<tr>
<td>Smith</td>
<td>John</td>
<td>[email protected]</td>
<td>$50.00</td>
<td>http://www.jsmith.com</td>
</tr>
<tr>
<td>Bach</td>
<td>Frank</td>
<td>[email protected]</td>
<td>$50.00</td>
<td>http://www.frank.com</td>
</tr>
<tr>
<td>Doe</td>
<td>Jason</td>
<td>[email protected]</td>
<td>$100.00</td>
<td>http://www.jdoe.com</td>
</tr>
<tr>
<td>Conway</td>
<td>Tim</td>
<td>[email protected]</td>
<td>$50.00</td>
<td>http://www.timconway.com</td>
</tr>
</tbody>
</table>
</body>
</html>
Mottie!感谢您指出我的错误。但是,这仍然不能解决问题。我已经编辑了我的代码供您阅读。我现在的问题是没有格式化发生,就好像tablesorter没有识别表格一样。我已删除表格“ID”,FYI。是的,我正在使用叉子。 –
那么现在这个插件正在初始化'$(“mytable”)'......它需要一个前面的'#'来使选择器变成一个ID或'.'作为类名,这两个都不会出现在HTML。 – Mottie
不,道歉是编辑(编辑)我忘了改变,如果你让我。我现在修改了它,可以确认它是'$(document).ready(function(){$('table')。tablesorter({...'在我的实际代码中,我也有'theme:'选项。蓝色',''设置在其他选项之前。仍然没有。 –