Serverside data and filtering from external control
Serverside data and filtering from external control
Hi
I have a Datatable with bServerSide:true and its corresponding sAjaxSource set. I've also enabled ordering in some columns and search. My question is:
Would it be possible to add a <select> with some static options and trigger on select.change a filtering and make this Datatable to filter the data by the option selected in this external select ?
If so, how should I change the code (corresponding to the ajax url) that gets the data and outputs the json?
Please lemme know if you'd need the serverside code
Thanks a lot in advance
This question has an accepted answers - jump to answer
Answers
Hi @kabeza ,
If the Select options are just search strings, then you could just call
search()
with that value - as it'sserverSide
, then that would communicate with the server without you needing to do anything more. Hope I'm understanding you correctly,Cheers,
Colin
Hi Colin
Yes, the select fields are generated dynamically from their corresponding CRUD modules. Each <option> tag has the value="id" from database and its corresponding type (string)
The problem is that I'll have multiple filters, I mean 3 or 4 select fields and then one "Apply Filter" button which should do the magic...
For that the
ajax.data
option would be your answer. Use that option as a function to get the data from your select filters and send it to the server-side script for use in a condition in the SQL.Allan
I'm working with "sAjaxSource" , not "ajax" property
When I change to "ajax" property, I get in my php controller the following errors:
unknown index iSortCol_0
unknown index iDisplayStart
unknown index iDisplayLength
unknown index sSortDir_0
Edit: I've found that I'm using legacy parameters. I'll modify my controllers to adapt to new parameters and accomodate to new $_GET array
Thanks!