Server Side Processing with deep array data
Server Side Processing with deep array data
nitin88
Posts: 6Questions: 0Answers: 0
Hi,
I am trying to use Server Side Processing for the Datatables.
However I am unable to show the results due to complex JSON data structure [or I am not finding how to show it]
Here's the sample JSON data that is being sent from the Server.
[code]
{
"sEcho": "1",
"iTotalRecords": 10,
"iTotalDisplayRecords": 5,
"aaData": {
"records": [
{
"attributes": {
"P_Close_Time": "1376493600",
"P_Description": "Test1"
},
"recordId": "6277988",
"url": "localhost:8888/search-engine/v1/search?recordId=6277985",
"aggregationCount": 0
},
{
"attributes": {
"P_Close_Time": "1376493600",
"P_Description": "Test2"
},
"recordId": "6277988",
"url": "localhost:8888/search-engine/v1/search?recordId=6277986",
"aggregationCount": 0
},
{
"attributes": {
"P_Close_Time": "1376493600",
"P_Description": "Test3"
},
"recordId": "6277988",
"url": "localhost:8888/search-engine/v1/search?recordId=6277987",
"aggregationCount": 0
},
{
"attributes": {
"P_Close_Time": "1376493600",
"P_Description": "Test4"
},
"recordId": "6277988",
"url": "localhost:8888/search-engine/v1/search?recordId=6277988",
"aggregationCount": 0
},
{
"attributes": {
"P_Close_Time": "1376493600",
"P_Description": "Test5"
},
"recordId": "6277988",
"url": "localhost:8888/search-engine/v1/search?recordId=6277989",
"aggregationCount": 0
}
]
}
}
[/code]
and this is my code
[code]
$('#example').dataTable({
"sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
},
"bProcessing" : true,
"bServerSide" : true,
"sAjaxSource" : "<%=dataresourceURL%>",
"aoColumns": [
{ "mData": "records.attributes.P_Close_Time" },
{ "mData": "records.attributes.P_Description" },
{ "mData": "records.url" }
]
});
[/code]
But I am unable to do it!
Could you please suggest how to get those items in the table.
I am trying to use Server Side Processing for the Datatables.
However I am unable to show the results due to complex JSON data structure [or I am not finding how to show it]
Here's the sample JSON data that is being sent from the Server.
[code]
{
"sEcho": "1",
"iTotalRecords": 10,
"iTotalDisplayRecords": 5,
"aaData": {
"records": [
{
"attributes": {
"P_Close_Time": "1376493600",
"P_Description": "Test1"
},
"recordId": "6277988",
"url": "localhost:8888/search-engine/v1/search?recordId=6277985",
"aggregationCount": 0
},
{
"attributes": {
"P_Close_Time": "1376493600",
"P_Description": "Test2"
},
"recordId": "6277988",
"url": "localhost:8888/search-engine/v1/search?recordId=6277986",
"aggregationCount": 0
},
{
"attributes": {
"P_Close_Time": "1376493600",
"P_Description": "Test3"
},
"recordId": "6277988",
"url": "localhost:8888/search-engine/v1/search?recordId=6277987",
"aggregationCount": 0
},
{
"attributes": {
"P_Close_Time": "1376493600",
"P_Description": "Test4"
},
"recordId": "6277988",
"url": "localhost:8888/search-engine/v1/search?recordId=6277988",
"aggregationCount": 0
},
{
"attributes": {
"P_Close_Time": "1376493600",
"P_Description": "Test5"
},
"recordId": "6277988",
"url": "localhost:8888/search-engine/v1/search?recordId=6277989",
"aggregationCount": 0
}
]
}
}
[/code]
and this is my code
[code]
$('#example').dataTable({
"sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
},
"bProcessing" : true,
"bServerSide" : true,
"sAjaxSource" : "<%=dataresourceURL%>",
"aoColumns": [
{ "mData": "records.attributes.P_Close_Time" },
{ "mData": "records.attributes.P_Description" },
{ "mData": "records.url" }
]
});
[/code]
But I am unable to do it!
Could you please suggest how to get those items in the table.
This discussion has been closed.
Replies
Allan
how do I use that data to show records, because the below code is throwing error when it encounters some special characters
[code]
"aaData": "${jsonResult.records}",
[/code]
Allan