vedmack/yadcf

Feature Request: dependent select based on column(s) filter

Opened this issue · 0 comments

Idea is to have select or multiselect values based on the filters currently set in one or more columns. Column parameter syntax would be similar to dependent: <column_selector> or dependent: [<column_selector>, ...]. Possibly column_selector needs to be limited to certain types, e.g., column number (index selector), {string}:name, string [jQuery selector], as not quite sure how dataTables columns() function will behave in other circumstances.

The dependent parameter would/could only be used on columns whose filter_type is select or multi_select.

Starting to research what it would take to supply PR for this -- I think need to do following, but any guidance would be appreciated.

On initialization,

  • within 'dependent' columns save the select columns which are dependent on the changes for this column

On dependent column change

  • save table state somehow
  • for each select column dependent on this column
    • execute .search().draw() for (only) this select column's dependent columns
    • update select options for this select column based on draw results()
  • restore table state

ref https://stackoverflow.com/questions/56224236/want-yadcf-filter-multiselect-options-based-on-another-filter-value