Search code examples
filteringyadcf

yadcf cumulative_filtering not filtering previous column?


http://yadcf-showcase.appspot.com/cumulative_filtering.html

If you begin with selecting "Tag 5" in the last column, the first column is not filtered to the only remaining selections (you get all values as selectable)

Is this a one way cumulative? (col1 first, then col2 then col3), or should the cumulative affect all other columns in the process forward and backward?

test case link here - https://jsfiddle.net/myc05td2/

Select Tab 2 in the last column, and Some Data 11 is still available in the first column.

Or, select Tab11 and you will see that it should only list Some Data 11 in the first column, but it shows all items in column 1


Solution

  • Found out the reason,

    You had an explicit cumulative_filtering: false for the first column, while the global was set to true.

    Once I removed that explicit false, the problem was solved

    {
        column_number : 0,
        filter_type: "multi_select",
        select_type: 'select2',
        cumulative_filtering: false
    }, 
    

    jsfiddle sample: https://jsfiddle.net/vedmack/2aLntwkf/

    Here is the complete code:

    var oTable;
    
    $(document).ready(function () {
        'use strict';
    
        
        oTable = $('#example').DataTable();
        
        yadcf.init(oTable,
            [
                {
                    column_number : 0,
                    filter_type: "multi_select",
                    select_type: 'select2'
                }, 
                {
                    column_number: 3,
                    filter_type: "auto_complete",
                    text_data_delimiter: ","
                },
                {
                    column_number : 4,
                    filter_type: "multi_select",
                    select_type: 'select2',
                    column_data_type: "html",
                    html_data_type: "text",
                    filter_default_label: "Select tag"
                }
            ],
            {
                cumulative_filtering: true
            }
        );
    });