Individual column searching with dymanic data (ajax)
Individual column searching with dymanic data (ajax)
ronphilly
Posts: 2Questions: 1Answers: 0
Has anyone been able to get this to work? I can only get this to work with static data. When I use dynamic AJAX data the dropdowns are not populated.
initComplete option does not work.
Any help is appreciated!
This question has an accepted answers - jump to answer
Answers
I got it working. I can search each column individually plus global search. But that doesn't require any kind of dropdown ... I have a search field on top of each column.
This example shows
input
element searching on the column.With dropdowns, you'll need to do something special. When
serverSide
is enabled,initComplete
will most likely trigger before the server responds with the data, so that may be why you're seeing what you are. Plus, withserverSide
, the client only has access to the data that you can see in the table at that time, so it won't be able to populate theselect
with values not present.If you want
select
elements, you'll need to query the server before the table is initialised to get a full list of all unique values in that column.Colin
Thanks Colin. So it's not quite as easy an out the box as Individual column searching - select inputs - (https://datatables.net/examples/api/multi_filter_select.html) indicates.
Pre-populating sounds hairier than I want to get into, I'll likely go with the search inputs.
Thanks much!