JSON SubArray Columm
JSON SubArray Columm
rainolf
Posts: 56Questions: 6Answers: 0
Hi,
i'm trying to display my data using server side php script.
My data comes to my Data Table in json with subarray inside like:
{
"iTotalDisplayRecords":"271",
"iTotalRecords":"273",
"sEcho":0,
"aaData":[
{"payroll_number":"001","employee_id":"2","employee_name":"John Doe","company":"MY COMPANY,"city":"MY CITY",
"leaves":[{"LTY001":"11.88"},{"LTY002":"26.13"}],
"timesheets":[{"punch_in_user_time":"2013-08-29 12:41:23","punch_in_note":"IN"}]
]
}
In my client code i've write something like:
"aoColumns": [
{ "mDataProp": "payroll_number", "iDataSort": 2, "sClass": "test", "sWidth":"50px"},
{ "mDataProp": "employee_name", "bVisible": true, "sClass": "test", "sWidth":"200px" },
{ "mDataProp": "company" ,"sClass": "test","sWidth":"100px" },
{ "mDataProp": "city","sClass": "test" },
]
and it works fine.
I need now to add additional colums where it belongs to a subarray like leaves or timesheets.
Could someone point me on the right way?
Thank you
i'm trying to display my data using server side php script.
My data comes to my Data Table in json with subarray inside like:
{
"iTotalDisplayRecords":"271",
"iTotalRecords":"273",
"sEcho":0,
"aaData":[
{"payroll_number":"001","employee_id":"2","employee_name":"John Doe","company":"MY COMPANY,"city":"MY CITY",
"leaves":[{"LTY001":"11.88"},{"LTY002":"26.13"}],
"timesheets":[{"punch_in_user_time":"2013-08-29 12:41:23","punch_in_note":"IN"}]
]
}
In my client code i've write something like:
"aoColumns": [
{ "mDataProp": "payroll_number", "iDataSort": 2, "sClass": "test", "sWidth":"50px"},
{ "mDataProp": "employee_name", "bVisible": true, "sClass": "test", "sWidth":"200px" },
{ "mDataProp": "company" ,"sClass": "test","sWidth":"100px" },
{ "mDataProp": "city","sClass": "test" },
]
and it works fine.
I need now to add additional colums where it belongs to a subarray like leaves or timesheets.
Could someone point me on the right way?
Thank you
This discussion has been closed.
Replies
Allan