Data Rendering - Query The Database
Data Rendering - Query The Database
Hello everyone,
I have come to the conclusion I need to manipulate my data through the render, however I am not sure where or how to go about it. I am looking for a bit of direction because I cant seem to find a manual of any sorts. Java is not my strong point.
I have data coming through Server Side Processing as this:
{
"draw": 0,
"recordsTotal": 2,
"recordsFiltered": 2,
"data": [
["ATS20151209_78983", "2|6|8|4", "1", "12-09-15", "CM20151020_999999999", "Curabitur egestas nunc nisl, sit amet feugiat erat tincidunt eu. Praesent consequat blandit venenatis. Pellentesque habitant mor"],
["ATS20151209_78984", "2|8", "3", "12-09-15", "CM20151020_999999998", ""]
]
}
There are two pieces of data I want to change before they are displayed. The first is an array of unknown size (In the above example give as 2|6|8|4 & 2|8). I want to query a table in my database that has the corresponds to the text values. Same thing with the second value except this time there is no array shown as 1 & 3 above.
I am not looking for anyone to write the code but a little direction is nice since the documentation is covering so much. I don't even know what I should be calling this or looking up.
Thank you.
This question has an accepted answers - jump to answer
Answers
As in you want to display a label that is identified by the integer value (a name for example)? Or you want to display the integer? I'm going to assume the former.
There are two options:
columns.render
function.I would suggest that 2 is easier - assuming you can change the data returned from the server.
There are other options as well - if you don't need the indexes, then just replace them with the data that is needed for example.
Allan
Option 2 sounds like what I want I am not sure though because the link you placed gives a 404.
The datatable should basically display Table Two but instead of showing employeeOwners as a number or array of numbers it should pull use the first table and get employeeName where employeeID = employeeOwners (Keeping in mind it could be an array but that parts simple).
Sorry - there should have been an
l
at the end of the URL. I've corrected it now.Allan
Is the purchase of the Editor needed to preform this join action? I do not need the functionality of editing from the front end (that is the purpose of forms).
Or do I just need to download some more files and change the file producing the JSON? Your documentation is great but only for those who understand it.
No. You can modify the server-side processing demo script to add join abilities or create your own server-side processing script that will suit your needs. The client / server protocol is documented in the manual.
I linked to the Editor example primarily just to show you the structure that I have used to solve this problem, not to try and sell Editor (in this case ;-) ).
Allan