我仅限于使用 tablesorter 功能,因为在父行下隐藏子行等。所以我使用“tablesorter mod”功能http://www.pengoworks.com/workshop/jquery/tablesorter/tablesorter.htm
当我尝试添加 dragtable.js 并尝试拖放时,只有当前页面会正确重新排列。在其他页面上,只有标题被移动,导致数据和标题不匹配。是否可以同时拥有分页、拖放和表格排序器功能。我只想拖放以移动所有页面的列,包括显示的页面。
<script type="text/javascript" src="jquery-1.2.3.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.tablesorter.mod.js"></script>
<script type="text/javascript" src="jquery.tablesorter.pager.js"></script>
<script type="text/javascript" src="jquery.tablesorter.collapsible.js"></script>
<script type="text/javascript" src="jquery.dataTables.js"></script>
<script type="text/javascript" src="ColReorder.js"></script>
<script type="text/javascript" src="dragtable.js"></script>
<script type="text/javascript">
$(document).ready(
function (){
$(".tablesorter")
/*
* td.collapsible = collapse to the first table row and show +/-
* td.collapsible_alt = anchor to order number
*/
.collapsible("td.collapsible", {
collapse: true
})
.tablesorter({
// set default sort column
sortList: [[4,0]],
// don't sort by first column
headers: {0: {sorter: false}}
// set the widgets being used - zebra stripping
, widgets: ['zebra']
, onRenderHeader: function (){
this.wrapInner("<span></span>");
}
, debug: false
})
.tablesorterPager({container: $("#pager"), positionFixed: false})
;
// Expand/Collapse all
$('a#ShowButton').click(function(){
var linkLabel = this.innerHTML;
switch(linkLabel)
{
case "Show History":
$("td.collapsible a").removeClass("expanded").click();
this.innerHTML= "Hide History"
break;
case "Hide History":
$("td.collapsible a").addClass("expanded").click();
this.innerHTML= "Show History"
break;
}
return false;
});
var oTable = $('#example').dataTable( {
"sDom": 'Rlfrtip'
} );
}
);
</script>