Search code examples
yadcf

Getting the selected filter from the multiselect column with yadcf


Hi I am using yadcf with datatables which allows me to do multiselect column filtering and that makes me happy. Now I want to display my selected values in the filter as tags to a separate search bar. How do I grab the selected values in my multiselect column filter? Thanks.


Solution

  • You should use the exGetColumnFilterVal method, like this:

    yadcf.exGetColumnFilterVal(oTable,1);
    

    See relevant docs (from yadcf js file)

    * exGetColumnFilterVal
                    Description:        Allows to retrieve  column current filtered value (support ALL filter types!!!)
                    Arguments:          table_arg: (variable of the datatable),
                                        column number:  column number from which we want the value
                    Usage example:      yadcf.exGetColumnFilterVal(oTable,1);
                    Return value:       String (for simple filter) / Object (for range filter) with from and to properties / Array of strings for multi_select filter