Convert json array to aadata format

微信扫一扫,分享到朋友圈

Convert json array to aadata format

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"
        },
    ]
}

how do i remove the column id and display just the values so that i can be read by datatables as a ajax call?

EDIT 8/29/2012

As of 1.9 you can disable having to have a root JSON property.

"sAjaxDataProp": "",

This is likely what you will get with most JSON serializers.

Or customize it

"sAjaxDataProp": "myData",

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"
        }
        ],

微信扫一扫,分享到朋友圈

Convert json array to aadata format

华为P20 Pro地表最强相机更新 AI推荐引擎遭官方“熄火”

上一篇

“传承计划”宣布后,阿里巴巴CEO张勇首次内部谈组织和管理

下一篇

你也可能喜欢

Convert json array to aadata format

长按储存图像,分享给朋友