Updating the select2 dropdown list along with search results

Updating the select2 dropdown list along with search results

PRASADRAJACSEPRASADRAJACSE Posts: 4Questions: 2Answers: 0

For one of my reports, I am using select2 inline filter along with the usual string and dropdown filter available here
https://datatables.net/extensions/fixedheader/examples/options/columnFiltering.html
Select2 dropdown lists all the available unique values of the particular column. I am looking for an option to update this dropdown list outside the initComplete() method so that whenever the table is filtered with other search conditions the select2 dropdown list is also updated with filtered rows.

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    The best place would be in search - that's called whenever a search is applied to the table. Another possible option would be draw, but that would also be called if the ordering is changed,

    Colin

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954

    See if Allan's example in this thread helps.

    Kevin

Sign In or Register to comment.