vedmack / yadcf

Yet Another DataTables Column Filter (yadcf)
http://yadcf-showcase.appspot.com/
MIT License
731 stars 285 forks source link

cumulative_filtering not working as expected on demo page, not filtering previous columns #674

Closed ikender closed 1 year ago

ikender commented 1 year ago

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?

posted to SO here: https://stackoverflow.com/questions/76111492/yadcf-cumulative-filtering-not-filtering-previous-column

vedmack commented 1 year ago

please provide a jsfiddle page with a similar behavior and I will check it out

ikender commented 1 year ago

please provide a jsfiddle page with a similar behavior and I will check it out

https://jsfiddle.net/myc05td2/ Select Tab 2 in the last column and "Some Data 11" is available still in the first column Or, select "Tab11" and you will see that it should only list "Some Data 11", but it shows all items in column 1

vedmack commented 1 year ago

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
        }
    );
});