[EDITOR] Populate table filtering by field
[EDITOR] Populate table filtering by field
Hi!
I used DataTables to show a table populated only with rows marked in certain field, on the table in database ("status: active" for example).
To do that I pre-process the data with javascript, and in the sql query and pass it then to DataTable as Json (as described in "Javascript sourced").
Now I'm working with Editor, but the tables can be populated by php a script that brings the entire table from database.
Is there a way to filter the data from database, by passing a parameter to the sql query?
Thanks!
Best regards,
Sergio
This question has accepted answers - jump to:
Answers
HI Sergio,
Assuming you are using the provided PHP libraries for Editor, then yes, you can provide
where
condition information for the SQL as described in the documentation here.Allan
Hi Allan! Thankyou very much for your quick reply! It was helpful.
Now I can't figure out how can I retrieve the ajax.data passed as parameter to url. I tried the solution given here but I dont know how can the server script get this value to apply the
where
condition.I'm working with the examples, here is the Javascript code
And here the PHP script code
Thank you very much!
I found the solution!
I find here some more information.
The
ajax.data
were in the wrong place (and other things)Here the correct code:
And php script