AJAX Source aaData and sAJAXDataProp
AJAX Source aaData and sAJAXDataProp
Hello @ all,
I need to solve a problem with server-side filtering and paging. The data I receive i formatted in JSON and it looks like that:
{
"METADATA" : {
"TOTAL" : 116,
"SELF-LINK" : "/rest/psi/releases",
"PARAMETERS" : [
{
"DB_NAME" : "PARAM1",
"INFO1" : "value",
"INFO2" : "value",
"LINK" : 1
},
{
"DB_NAME" : "PARAM2",
"INFO1" : "value",
"INFO2" : "value",
"LINK" : 1
},
{
"DB_NAME" : "PARAM3",
"INFO1" : "value",
"INFO2" : "value",
"LINK" : 0
}
],
"TIMESTAMP" : "none"
},
"DATA" : [
{
"LINKS" : {
"link1" : "/placeholder/placeholder/placeholder/placeholder",
"link2" : "/placeholder/placeholder/placeholder/placeholder"
},
"GRANTS" : [
"UPDATE",
"DELETE"
],
"VALUES" : {
"PARAM1" : "value",
"PARAM2" : "value",
"PARAM3" : "value"
}
},
{
"LINKS" : {
"link1" : "/placeholder/placeholder/placeholder/placeholder",
"link2" : "/placeholder/placeholder/placeholder/placeholder"
},
"GRANTS" : [
"UPDATE",
"DELETE"
],
"VALUES" : {
"PARAM1" : "value",
"PARAM2" : "value",
"PARAM3" : "value"
}
}
}
]
}
As far as I know, I need to use aaData and / or sAJAXDataProp to solve this problem. As you can see METADATA and DATA are on the same Level of the JSON data, but I dont know how to add this in DataTable by using sAJAXDataProp or aaData. If I am using aaData I need to add it to the JSON Data and it would look like this:
aaData : [
METADATA: {
...
},
DATA: {
...
}
]
I think I would rather using sAJAXDataProp, but then I need to add METADATA and DATA to it, but I dont know how.
Would it be something like this?
"sAjaxDataProp": ["METADATA", "DATA"]
I appreciate every help,
thanks in advance
I need to solve a problem with server-side filtering and paging. The data I receive i formatted in JSON and it looks like that:
{
"METADATA" : {
"TOTAL" : 116,
"SELF-LINK" : "/rest/psi/releases",
"PARAMETERS" : [
{
"DB_NAME" : "PARAM1",
"INFO1" : "value",
"INFO2" : "value",
"LINK" : 1
},
{
"DB_NAME" : "PARAM2",
"INFO1" : "value",
"INFO2" : "value",
"LINK" : 1
},
{
"DB_NAME" : "PARAM3",
"INFO1" : "value",
"INFO2" : "value",
"LINK" : 0
}
],
"TIMESTAMP" : "none"
},
"DATA" : [
{
"LINKS" : {
"link1" : "/placeholder/placeholder/placeholder/placeholder",
"link2" : "/placeholder/placeholder/placeholder/placeholder"
},
"GRANTS" : [
"UPDATE",
"DELETE"
],
"VALUES" : {
"PARAM1" : "value",
"PARAM2" : "value",
"PARAM3" : "value"
}
},
{
"LINKS" : {
"link1" : "/placeholder/placeholder/placeholder/placeholder",
"link2" : "/placeholder/placeholder/placeholder/placeholder"
},
"GRANTS" : [
"UPDATE",
"DELETE"
],
"VALUES" : {
"PARAM1" : "value",
"PARAM2" : "value",
"PARAM3" : "value"
}
}
}
]
}
As far as I know, I need to use aaData and / or sAJAXDataProp to solve this problem. As you can see METADATA and DATA are on the same Level of the JSON data, but I dont know how to add this in DataTable by using sAJAXDataProp or aaData. If I am using aaData I need to add it to the JSON Data and it would look like this:
aaData : [
METADATA: {
...
},
DATA: {
...
}
]
I think I would rather using sAJAXDataProp, but then I need to add METADATA and DATA to it, but I dont know how.
Would it be something like this?
"sAjaxDataProp": ["METADATA", "DATA"]
I appreciate every help,
thanks in advance
This discussion has been closed.
Replies
Allan
Is it possible to solve this problem by using Ajax Source and fnServerData? I just read something about it? Sorry for bothering you.
Or is fnServerData also expecting a 2D array?
Thanks again
Allan