问题描述
这是我的json返回数据的方式
{page:0,total:0,records:0,rows:[ {id:60605285,cell:[60605285,acme advertising cds,2/1/2001,2/1/2801,,704034,9/7 / 2015 7:26:36 PM,
1/1/1900 12:01:00 AM,,,542,,]}]}
如何绑定到这个脚本
$(文件).ready(function(){
$('#example')。DataTable({
processing:true,
serverSide:true,
ajax:{
url:JQGridHandler.ashx,
cache:true,
dataSrc:行
}
搜索:true,//可选
分页:true,
bServerSide:false,
aaSorting:[[1,'desc'],[2,'asc']],/ /可选
响应:true,//可选
bAutoWidth:false,//可选
orderable:true,/ /第1部分 - 总是如此。
栏目:[
{data:Estimate_ID},
{data :ESTIMATE_DESCRIPTION,orderable:false},
{data:FLIGHT_START_DATE},
{data:FLIGHT_END_DATE},
{data:ESTIMATE_COMMENTS,orderable:false},
{data:AGENCY_ID},
{ data:UPD_DATE},
{data:PROC_DATE,orderable:false},
{data:ESTIMATE_CD},
{data:SALES_ASSISTANT},
{data:AE_STAFF_ID,orderable:false},
{data:order_type_id},
{data:cost_type}
]
});
});
This is how my json return data
{"page": 0,"total": 0,"records": 0,"rows":[{"id":60605285,"cell":["60605285","acme advertising cds","2/1/2001","2/1/2801"," ","704034","9/7/2015 7:26:36 PM",
"1/1/1900 12:01:00 AM","","","542","",""]}]}
how can i bind to this script
$(document).ready(function () {
$('#example').DataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": "JQGridHandler.ashx",
"cache": true,
"dataSrc": "rows"
}
"searching": true, // Optional
"paging": true,
"bServerSide": false,
"aaSorting": [[1, 'desc'], [2, 'asc']], // Optional
"responsive": true, // Optional
"bAutoWidth": false, // Optional
"orderable": true, // Part 1 - Always true.
"columns": [
{ "data": "Estimate_ID" },
{ "data": "ESTIMATE_DESCRIPTION", "orderable": false },
{ "data": "FLIGHT_START_DATE" },
{ "data": "FLIGHT_END_DATE" },
{ "data": "ESTIMATE_COMMENTS", "orderable": false },
{ "data": "AGENCY_ID" },
{ "data": "UPD_DATE" },
{ "data": "PROC_DATE", "orderable": false },
{ "data": "ESTIMATE_CD" },
{ "data": "SALES_ASSISTANT" },
{ "data": "AE_STAFF_ID", "orderable": false },
{ "data": "order_type_id" },
{ "data": "cost_type" }
]
});
});
推荐答案
这篇关于如何使用服务器端将我的Json数据绑定到数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!