How To Convert Column To Row In Client-Side Datatable ?
How To Convert Column To Row In Client-Side Datatable ?
odydahary
Posts: 19Questions: 3Answers: 0
Hi All...
I'm really confused, I have data in a database with the following description:
And I expect the data on the client side to be displayed like the following image:
Can anyone help me? I have made some code in JSFiddle with following link:
Replies
How are you currently querying the database to get the data?
A query on the second table with a left join to the teacher table would be the first step.
Allan
Thanks for your feedback Allan.
I've handled the query, but when the data gets to the client side, I want the
sub_criteria_id
to line up sideways like a picture number 3.If you are unable to build the table the way you want with a DB query then you will need to loop through the query results to build the three sub_criteria_id columns. You can do this in your server script before returning the data. Or you can use a Javascript loop and re-arrange the data before Datatables loads it. If you are using the
ajax
option you can useajax.dataSrc
to manipulate the json response.Kevin
Thanks for your feedback Kevin.
Yes, i wanna try that.