Search code examples
javascriptdatatablesyadcf

yadcf for DataTables: Show only filtered/available values in select dropdown-box


Is there a way in yadcf for DataTables, for the values in select2 dropdown-boxes, to adapt to the current filtering of the table.

That means: I want to only see the values in the dropdown-box which are visible in the table right now.

Example: Go here: http://yadcf-showcase.appspot.com/DOM_source_chosen.html

And see my screenshot: enter image description here

After filtering column 1, I'd expect the tag-column to only show "Tag 1", "Tag 2", "Tag 3" because only those are remaining...

Is there a way to do it?

Thanks a lot!


Solution

  • You should use the cumulative_filtering option of the yadcf

    See live demo page https://yadcf-showcase.appspot.com/cumulative_filtering.html

    • cumulative_filtering Required: false Type: boolean Default value: false Description: Change the default behavior of the filters so its options will be populated from the filtered rows (remaining table data after filtering) only, unlike the normal behavior in which the options of the filters are from all the table data