Individual column searching with dymanic data (ajax)

Individual column searching with dymanic data (ajax)

ronphillyronphilly 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

  • rf1234rf1234 Posts: 3,000Questions: 87Answers: 421

    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.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    edited February 2022 Answer ✓

    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, with serverSide, 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 the select 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

  • ronphillyronphilly Posts: 2Questions: 1Answers: 0

    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!

Sign In or Register to comment.