将json数组转换为aadata格式 [英] convert json array to aadata format
本文介绍了将json数组转换为aadata格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的currrent数组格式不被数据表aaData格式解释为im传递列值:
my currrent array format is not being interpreted by datatables aaData format as im passing column values:
{
"aaData": [
{
"startDate": "09/08/2010 12:00:00 AM",
"endDate": "13/08/2010 12:00:00 AM",
"runDate": "16/08/2010 12:00:00 AM",
"clientId": "40272",
"clientType": "C",
"plannerName": "Adrian Mcfly",
"plannerRegion": "s1",
"contact": "Vera chaniqua",
"email": " ",
"interviewDate": "09/08/2010 12:00:00 AM"
},
]
}
我如何删除列ID并显示值,以便我可以通过数据表作为ajax调用读取?
how do i remove the column id and display just the values so that i can be read by datatables as a ajax call?
推荐答案
编辑8/29/2012
从1.9开始,具有根JSON属性。
As of 1.9 you can disable having to have a root JSON property.
"sAjaxDataProp": "",
这可能是你会得到的大多数JSON序列化程序。
This is likely what you will get with most JSON serializers.
或自定义
"sAjaxDataProp": "myData",
在数据表1.8中,您可以像这样格式化json:
In datatables 1.8 you can format your json like this:
{
"aaData": [
{
"DT_RowClass": "",
"description": "",
"pkgLineTree": {
"treeId": {
"name": "Jacksonville"
}
}
},
{
"DT_RowClass": "",
"description": "",
"pkgLineTree": {
"treeId": {
"name": "Jacksonville"
}
}
}
]
}
在您的数据属性中添加此
And in your datatable properties add this
"aoColumns": [
{
"mDataProp": "pkgLineTree.treeId.name"
},
{
"mDataProp": "shortname"
},
{
"mDataProp": "description"
},
{
"mDataProp": "lineStatus"
}
],
这篇关于将json数组转换为aadata格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文