我无法获得Tablesorter复选框功能。 我想在thead中添加一个复选框,目的是让用户选择是否全部检查。
这是我的jscript代码:
<script type="text/javascript">
$(document).ready(function(){
$("#tabs").tabs({
create: function (event, ui) {
var $t = ui.panel.find('table');
if ($t.length) {
$t.tablesorter(tablesorterOptions2);
}
},
activate: function (event, ui) {
var $t = ui.newPanel.find('table');
if ($t.length) {
if ($t[0].config) {
$t.trigger('applyWidgets');
} else {
$("#table4").tablesorter(tablesorterOptions2);
}
}
}
});
var tablesorterOptions2 = {
theme: 'blue',
widthFixed: true,
widgets: ["zebra", "resizable" ,"columns" ,"stickyHeaders", "filter" , "editable"],
headers: {0: { sorter: "checkbox" }}};
};
这是我的桌子开始的方式:
<table id='table4' class="tablesorter" width="100%">
<thead>
<tr>
<th><input type="checkbox"/></th>
表格中的数据会消失,除非我按照几种方式对其进行排序和过滤。
谢谢!