-
Notifications
You must be signed in to change notification settings - Fork 284
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
Comments
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) |
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.
|
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 :) |
so im happy that im maybe a bit usefull, not only hated spamer :) |
…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
Added exResetAllFilters function to 0.8.4.beta.5
|
* 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
added in 0.8.4 , updated docs / showcase , see http://yadcf-showcase.appspot.com/DOM_source_chosen.html (and couple other pages) |
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?
The text was updated successfully, but these errors were encountered: