jquery datatable
After getting data from the server, for example :
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "xhr.php"})}
I want to sort the data by the specified column on the client side using js language, what should I do ? How to sort the data I get from the server using the functions datatable provide?
即我从服务器端获取数据后,想对其在客户端进行排序,并将最终结果以排序完的结果展示出来,改如何做?
------解决方案--------------------now,you should find the parameter in the datatable document. the specified parameter usual have .
------解决方案-------------------- Using the aaSorting initialisation parameter, you can get the table exactly how you want to present the information. The aaSorting parameter is an array of arrays where the first value is the column to sort on, and the second is 'asc' or 'desc' as required (it is a double array for multi-column sorting).
$(document).ready(function() {
$('#example').dataTable( {
"aaSorting": [[ your column number, "desc" ]]
} );
} );
------解决方案--------------------呃。。。 can you speak chinese!!!
$(document).ready(function(){
setTbody();
var Pageheight = document.documentElement.clientHeight;//页面的高度
var height = Pageheight-135;//135=数据操作区域的高度+thead的高度+分页区域的高度 (这三部分的高度都是不变的)
var oTable = $('#example').dataTable({
"bStateSave": false, //保存状态到cookie ******很重要 , 当搜索的时候页面一刷新会导致搜索的消失。使用这个属性设置为true就可避免了
"bPaginate": true,// 是否使用分页
"bProcessing": true, //是否显示正在处理的提示
"bLengthChange": false,//是否启用设置每页显示记录数
"iDisplayLength":100,//默认每页显示的记录数
"bFilter": true, //是否使用搜索
"bJQueryUI": true, //页面风格使用jQuery.
// "sScrollY": 200,//竖向滚动条 tbody区域的高度
"sScrollX": "100%",//横向滚动条
"sScrollXInner": "100%",
"bScrollCollapse": true,
"oLanguage": {//语言国际化
"sUrl": "<%=path %>/css/datatables/dt.txt"
},
"sPaginationType": "full_numbers",//分页样式
"bAutoWidth":true