Manipulate ajax rendered data
Manipulate ajax rendered data
islamelshobokshy
Posts: 99Questions: 20Answers: 1
My json returned data have this form :
"status":"success",
"data":[
{
"A":"A",
"B":"B",
"C":"773",
"D":"0.00",
"F":"0",
.. etc
},
{
"A":"A",
"B":"B",
"C":"773",
"D":"0.00",
"E":"0",
.. etc
},
.. etc
I want to only take these results from the table :
"status":"success",
"data":[
{
"A":"A",
"C":"773",
"E":"0",
.. etc
},
{
"A":"A",
"C":"773",
"E":"0",
.. etc
},
.. etc
How can I do this ? In other words, only take certain results to be rendered in my table.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Knowing that, for example, the first 3 data will be used in the th in the body, the next 3 will be used in the tfoot, and the last 2 won't be used anywhere... How can I achieve such a 'complex' manipulation?
In other words, I want to be able to control what is being drawn and where from the json inside my DataTables. I'm sorry for the multiple posts, I can't edit my previous one... I can't seem to find out anything about this in the forums.
Hi @islamelshobokshy ,
Take a look at the orthogonal data example here, this should help. This shows how to pull out fields from the JSON while ignoring the rest.
I don't understand what you mean by "the next 3 will be used in the tfoot" - there is only a single (well, limited) tfoot, so I don't see how you want to use data from each record to populate it.
Cheers,
Colin
Let me try to explain more clearly :
I have a data object containing multiple data for each row. In each of this row's data there are 10 columns. A, B, C, D .. etc, each having a unique key. I want to populate the body with A, B, E. And the footer with F, G, K. Is that possible? Otherwise I'll have to pass 2 json files, one for the body and one for the footer to be used.
So if you've got 100 rows, that's 100 F,G,Ks for the footer!? How would that work?
They would be the same values for all of them, so if the footer uses data[0].element it would be fine. it's okay tho I managed by another mean