vedmack / yadcf

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

cumulative_filtering as a button? #596

Closed GregJobs closed 5 years ago

GregJobs commented 5 years ago

This is more of a how to, or an is it possible so I don't have a fiddle.

I know you cannot use cumulative_filtering with multi_select, but I was wondering if, using the buttons for DT, or making a custom function somehow with yadcf, or something... we could "toggle" the true/false state of the setting?

vedmack commented 5 years ago

what setting? please provide a more clear explanation of your goal

GregJobs commented 5 years ago

cumulative_filtering

GregJobs commented 5 years ago

A change from true/false for cumulative filtering and I assume reinitialization of yadcf would be necessary?

I'm just not 100% certain. Honestly I'd love it if the multi_select with select2 worked with cumulative_filtering though.

vedmack commented 5 years ago

still not getting the flow/scenario you are trying to achieve, but you can add a button that will re-init yadcf with different arguments, as to the

multi_select with select2 worked with cumulative_filtering

I will try to find some time for checking this once again

GregJobs commented 5 years ago

So, I wrote this button { text: 'Cumulative Filtering ' + c_filter_name, action: function ( e, dt, node, config ) { if(c_filter==false){ c_filter = true; c_filter_name = "On"; } else { c_filter = false; c_filter_name = "Off"; } this.text('Cumulative Filtering ' + c_filter_name); yadcf.init(example, yadcfd, { cumulative_filtering: c_filter } ); //yadcf.exResetAllFilters(example, noRedraw); } } ...and it works fine however the issue I have with it is in this scenario since I'm using select2 with multi_select as in this issue (https://github.com/vedmack/yadcf/issues/448) Clearing the current filters causes a delay that is significant for some reason. As you can see from the commented out line I also tried noRedraw option as well as trying exFilterColumn in it's place. Both cause a long redraw delay that I cannot seem to avoid. Any thoughts? yadcf.exFilterColumn(example, [ [0, ""], [1, ""], [2, ""], [3, ""], [4, ""], [5, ""], [6, ""], [7, ""], [8, ""], [9, ""] ]);

GregJobs commented 5 years ago

Actually a nice "feature" this creates is that by spinning up the table with cumulative_filtering false, making selections, then turning it ON, the filters actually play along as though multi-select CAN use cumulative_filtering, really interesting and maybe how this now functions can lend insight in how to correct the multi-select select2 cumulative filtering "bug"?

I'll see if I can get a fiddle going.