本文介绍了jQuery DataTable按Metronic管理主题中的第一列排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用由某人创建的管理主题,它按我的dataTables中的第二列对所有dada进行排序.我试图更改数据表的jQuery文件,但没有发生.他使用不同的初始化来调用它..

I'm using admin theme whichone created by some guy and it orders all dada by second column in my dataTables. I tried to change datatable jquery file, but nothin happened. He uses different initialization to call it..

jQuery(document).ready(function() {    
     App.init(); // initlayout and core plugins
     TableAdvanced.init();              
  });

我不知道要更改什么以禁用排序或按第一列进行排序.这是主题: http://keenthemes.com/preview/metronic_admin/table_advanced.html 也许有人知道答案?

And I don't know what to change to disable ordering or make it order by first column..This is the theme: http://keenthemes.com/preview/metronic_admin/table_advanced.htmlMaybe someone know a answer?

推荐答案

如果要在第一列中添加排序",则需要使用类似

If you want to add the Sorting by the first column you will need to use something like this

$("#sample_1").dataTable({
   "aaSorting" : [[0,"desc"]],
   "bDestroy":true
});

注意:使用"bDestroy"它将用具有新属性的数据表替换您的数据表,因此这样做将覆盖dataTable的先前配置.

Note: Using "bDestroy" it will replace your datatable with one with the new properties, so doing this will overwrite the previous configuration of the dataTable.

我认为最好的解决方案是找出在TableAdvanced.init()

I think that the best solution is to look out where the datatable is created inside that TableAdvanced.init()

并向其添加参数aaSorting

And add the parameter aaSorting to it

"aaSorting" : [[0,"desc"]]

这可能有效 http://datatables.net/examples/basic_init/table_sorting.html

这篇关于jQuery DataTable按Metronic管理主题中的第一列排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 22:39