Can I use the search() functionality to provide an alternate SQL statement to perform the search?
Can I use the search() functionality to provide an alternate SQL statement to perform the search?
menashe
Posts: 196Questions: 43Answers: 2
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Answers
One option, if using
ajax
, might be to useajax.data
as a function to send search parameters to the server. Useajax.reload()
to fetch a new set of data with the parameters. See this example.If this doesn't help then please provide details of your Datatables environment and what you would like to do.
Kevin
Kevin,
I do not think that will help.
Asd a simple example:
I have table A, which contains "Item".
Table B, contains "Item_ID" and "Description".
My DataTable display data from table A, but when searching (filtering) I would like to be able to search on additional fields that are only in table B--such as Description--and display the corresponding record(s) from table A.
You would just join both tables as input for your data table and hide the columns "Item_ID" and "Description" in your data table display. Done.
I have just tested it: The search field works with hidden columns as well. Since search is performed client side you MUST download those extra columns to the client (unless you are using serverSide which I would only recommend if absolutely required due to its multiple negative implications).