Skip to content

Commit

Permalink
Added exResetFilters function to reset specific filters (one or more)
Browse files Browse the repository at this point in the history
  • Loading branch information
vedmack committed Mar 10, 2015
1 parent 36164e9 commit 30e41b0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions ChangeLog.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 0.8.8.beta (still in development

* Added exResetFilters function to reset specific filters (one or more) https://github.com/vedmack/yadcf/issues/162
* Added html5_data support for range_number and range_number_slider https://github.com/vedmack/yadcf/issues/158
* Added externally_triggered and exFilterExternallyTriggered function to allow creating "search forms" , fill the filters and hit the "filter" button to filter them all https://github.com/vedmack/yadcf/issues/141
* ColReorder support for all filter types! https://github.com/vedmack/yadcf/issues/138
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This jQuery plug-in allows the user to easily add filter components to table col

Contact/Social:
=====
If you want to ask a question you can post a question on [stackoverflow](www.stackoverflow.com) with 'yadcf' tag or use my [google group](https://groups.google.com/forum/#!forum/daniels_code)
If you want to ask a question you can post a question on [stackoverflow](www.stackoverflow.com) with [yadcf](http://stackoverflow.com/questions/tagged/yadcf) tag or use my [google group](https://groups.google.com/forum/#!forum/daniels_code)

If you like my plugin, you can show your appreciation by following me on [Twitter](https://twitter.com/danielreznick) / [GitHub](https://github.com/vedmack)

Expand Down
22 changes: 18 additions & 4 deletions beta/jquery.dataTables.yadcf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Yet Another DataTables Column Filter - (yadcf)
*
* File: jquery.dataTables.yadcf.js
* Version: 0.8.8.beta.8
* Version: 0.8.8.beta.9
*
* Author: Daniel Reznick
* Info: https://github.com/vedmack/yadcf
Expand Down Expand Up @@ -210,7 +210,12 @@
Arguments: table_arg: (variable of the datatable)
Usage example: yadcf.exResetAllFilters(oTable);
* exResetFilters
Description: Allows to reset specific filters externally/programmatically (support ALL filter types!!!) , can be used for resetting one or more filters
Arguments: table_arg: (variable of the datatable)
array with columns numbers
Usage example: yadcf.exResetAllFilters(oTable, [1,2]);
*
*
*
Expand Down Expand Up @@ -3197,7 +3202,7 @@ var yadcf = (function ($) {
}
}

function exResetAllFilters(table_arg) {
function exResetAllFilters(table_arg, columns) {
var table_selector_jq_friendly,
column_number,
fromId,
Expand All @@ -3217,6 +3222,10 @@ var yadcf = (function ($) {
if (tableOptions.hasOwnProperty(columnObjKey)) {
optionsObj = tableOptions[columnObjKey];
column_number = optionsObj.column_number;

if (columns !== undefined && $.inArray(column_number, columns) === -1) {
continue;
}
$(document).removeData("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val");

switch (optionsObj.filter_type) {
Expand Down Expand Up @@ -3298,6 +3307,10 @@ var yadcf = (function ($) {
table_arg.fnDraw();
}

function exResetFilters(table_arg, columns) {
exResetAllFilters(table_arg, columns);
}

function exFilterExternallyTriggered(table_arg) {
var columnsObj,
columnObjKey,
Expand Down Expand Up @@ -3353,7 +3366,8 @@ var yadcf = (function ($) {
textKeyUpMultiTables: textKeyUpMultiTables,
doFilterMultiTables: doFilterMultiTables,
generateTableSelectorJQFriendlyNew: generateTableSelectorJQFriendlyNew,
exFilterExternallyTriggered: exFilterExternallyTriggered
exFilterExternallyTriggered: exFilterExternallyTriggered,
exResetFilters: exResetFilters
};

}(jQuery));

0 comments on commit 30e41b0

Please sign in to comment.