Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to reset all filters by single button/function call #78

Closed
Muhahe opened this issue Aug 31, 2014 · 6 comments
Closed

option to reset all filters by single button/function call #78

Muhahe opened this issue Aug 31, 2014 · 6 comments

Comments

@Muhahe
Copy link

Muhahe commented Aug 31, 2014

Hi again,

i just wana ask, if there is a option to reset all filters by one button (single function call), or is it missing?

@vedmack
Copy link
Owner

vedmack commented Aug 31, 2014

You can use the exFilterColumn function for that , read the docs about it and see the showcase example http://yadcf-showcase.appspot.com/multiple_tables.html , I will leave this issue open as I might add additional function for that reset all button (but since its already can be achieved with current yadcf API the priority is low...

p.s seen your solution about the previous issue (render) and it looks good! (will try it out whenever I'll get a chance)

@Muhahe
Copy link
Author

Muhahe commented Sep 1, 2014

Maybe this can help in future. I did not tested it much, but for first look it seems like working.

function doResetAllFilters(table_selector_jq_friendly){

            $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly];
            var oTable = oTables[table_selector_jq_friendly];
            var columnsData = yadcf.getOptions(oTable.selector);
            var column_number;
            for(var i = 1; i < Object.keys(columnsData).length;i++){
                column_number = columnsData[i].column_number
                $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).val("-1").focus();
                $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).removeClass("inuse");
                $(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val", "-1");
                oTable.fnFilter("", column_number);
                resetIApiIndex();
                if (yadcf.getOptions(oTable.selector)[column_number].select_type === 'chosen') {
                    $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).trigger("chosen:updated");
                }
            }
            resetIApiIndex();
            return;
        }

and registration at the end of yadcf. WIthout it i was not able to call function.

doFilterMultiSelect : doFilterMultiSelect,

@vedmack
Copy link
Owner

vedmack commented Sep 1, 2014

Thanks, but using the above code will trigger multiple filter calls (instead of one per all columns) and it works only for select filter type (maybe on more) and not for all the 9 types, the solution will look similar to the exFilterColumn function or even use it as part of the solution, but thanks and b.t.w your other proposal for the #76 looks promising :)

@Muhahe
Copy link
Author

Muhahe commented Sep 1, 2014

so im happy that im maybe a bit usefull, not only hated spamer :)

vedmack added a commit that referenced this issue Sep 26, 2014
…xternally/programmatically (support ALL filter types!!!) , perfect for adding a "reset all" button to your page!

									(in server side loading "serverSide": true not supporting

#78
@vedmack
Copy link
Owner

vedmack commented Sep 26, 2014

Added exResetAllFilters function to 0.8.4.beta.5

* exResetAllFilters
                Description:        Allows to reset all filters externally/programmatically (support ALL filter types!!!) , perfect for adding a "reset all" button to your page!
                                    (in server side loading "serverSide": true not supporting range filters)
                Arguments:          table_arg: (variable of the datatable)                                  
                Usage Example:      yadcf.exResetAllFilters(oTable);

vedmack added a commit that referenced this issue Oct 7, 2014
* New feature, added initFilterMultipleTables function, one (currently only filter_type: "text") filter for multiple tables - filter at once! #80
* New feature, added exResetAllFilters function: Allows to reset all filters externally/programmatically (support ALL filter types!!!) , perfect for adding a "reset all" button to your page! #78
* exGetColumnFilterVal support new Datatable  (Capital "D") https://groups.google.com/forum/#!topic/daniels_code/4ryW4_0P2EE
* Fixed IE8 issues #73
* Migrated to MIT license #82
* Better support for columnDefs
* Date filtering with server side configuration will send the value / from-to (if range date) as is (without converting into milliseconds)
* Bug fixes #83
@vedmack
Copy link
Owner

vedmack commented Oct 7, 2014

added in 0.8.4 , updated docs / showcase , see http://yadcf-showcase.appspot.com/DOM_source_chosen.html (and couple other pages)

@vedmack vedmack closed this as completed Oct 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants