search field Editor datatable questions
search field Editor datatable questions
first question: how search field work on server-Side when get the data from editor database function? did the search field search on all columns?
second question: if i have table that get data from other function that return json how i can make the search work as with the editor database return json function?
third question: when using server-side with editor datatbase function, i get this message when try to search input:
DataTables warning: table id=example - Unknown field: ServiceType (index 5)
if i make server-side= false the search input works fine
thanks
Answers
"how search field work on server-Side when get the data from editor database function? did the search field search on all columns?"
The search is performed on all columns based on the values returned from the database BEFORE any getFormatting. MySQL would save a date usually as
2020-01-01 00:00:00. If you are searching for this date with server side turned on you will only find it if you enter exactly this or you transform your search string before sending it to the server or you use a view that returns the date in the format your users see at the front end.
"second question: if i have table that get data from other function that return json how i can make the search work as with the editor database return json function?"
Just pass the search string to the server in the ajax-call that you use to get the data and use "LIKE" in your SQL statement to filter.
d.search.value has the content of the search field like in here. The function you see right here can be used to manipulate the search string entered by the user so that it matches with the database format.
Here is an example for a proprietary search using the Data Tables search field but NOT data tables smart search but my own search which is based on two views containing the formatted values that the user sees at the front-end in the language the user selected.
"third question: when using server-side with editor datatbase function, i get this message when try to search input:"
You seem to have a mismatch between your HTML and your Javascript columns. I would also check the server code whether the field in question is being retrieved.