How to apply advanced search on datatable using input text and select?
How to apply advanced search on datatable using input text and select?
Ali-aati
Posts: 8Questions: 3Answers: 0
Hi, I tried many of different way to apply advanced search on table using Datatable with all of input text and dropdown select but not working with me this is example of my code could anyone help me with my problem and this I want When I fill all the search filed than click on filter button show data in table.
This discussion has been closed.
Answers
Hi @Ali-aati ,
It looks like you don't have any
click
event on the 'Filter' button, so it won't do anything!What you need to do in that event handler is take your search elements, and apply the search to the relevant column. Something like:
Hope that helps,
Cheers,
Colin
Hi @colin
Now I used Search API (regular expressions) Here And everything work fine except three things,
One select dropdown not working when I sleeted in data from dropdown,
second when I search for date like 05/22/2018 to 07/13/2018 in input from work but in to input not working, and
the last thing I need to use button for filter. how cloud do that please I need help for those things.
this is my new example http://live.datatables.net/piqidoqo/646/edit
I fixed the Select downdrop but when i select all should show all the data. how can I do that?
this new link
http://live.datatables.net/piqidoqo/648/edit
Hi @Ali-aati ,
The problem is because you're searching for "All" in the table, which doesn't match anything. You could either detect that before you applying the search and change the value to be "", or you could apply an attribute to each option which you search on (for All it would be "", for the rest, it would be value).
Hope that helps,
Cheers,
Colin
Thank you so much @colin
I used this code and It worked.
` <option selected value> -- All -- </option>``
could you please help me for this one
when I search for date like 05/22/2018 to 07/13/2018
the from 05/22/2018 work but 07/13/2018 input to not working how could fix that.
http://live.datatables.net/piqidoqo/648/edit
Hi @Ali-aati ,
This plugin here should help, it's searching for date ranges,
Cheers,
Colin