在 jquery Datatables 中是否可以使用服务器端脚本定义列? 我需要这样的东西
必须从服务器加载带有日期的列。 然后列数可以变化。
最佳答案
我想我已经找到了你要找的东西
我将粘贴一些代码并发布一个类似 Q' 的链接,您将在其中获得更多信息...
$.ajax( {
"url": 'whatever.php',
"success": function ( json ) {
json.bDestroy = true;
$('#example').dataTable( json );
},
"dataType": "json"
} );
其中 json 是这样的
{
"aaData": [
[ "2010-07-27 10:43:08", "..."], [ "2010-06-28 17:54:33", "..."],
[ "2010-06-28 16:09:06", "..."], [ "2010-06-09 19:15:00", "..."]
] ,
"aaSorting": [
[ 1, "desc" ]
],
"aoColumns": [
{ "sTitle": "Title1" },
{ "sTitle": "Title2" }
]
}
这里是原始线程的链接
关于jquery datatables - 从 json 获取列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8665309/