Skip to content

Commit

Permalink
bug fix: #482 - Autocomplete is not reading filter_plugin_options
Browse files Browse the repository at this point in the history
  • Loading branch information
vedmack committed Jul 25, 2018
1 parent 135fa9f commit 6c5c002
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions ChangeLog.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Misc bug fixed issues:
https://github.com/vedmack/yadcf/issues/469 - Cannot apply style_class on date filter
https://github.com/vedmack/yadcf/issues/470 - filter_delay not working on range_date
https://github.com/vedmack/yadcf/issues/482 - Autocomplete is not reading filter_plugin_options

## 0.9.3

Expand Down
12 changes: 8 additions & 4 deletions src/jquery.dataTables.yadcf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Yet Another DataTables Column Filter - (yadcf)
*
* File: jquery.dataTables.yadcf.js
* Version: 0.9.4.beta.2
* Version: 0.9.4.beta.3
*
* Author: Daniel Reznick
* Info: https://github.com/vedmack/yadcf
Expand Down Expand Up @@ -3051,14 +3051,18 @@ if (!Object.entries) {
$(filter_selector_string).find(".yadcf-filter").val($(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val"));
}
if (columnObj.filter_type === "auto_complete") {
columnObj.filter_plugin_options = {
let autocompleteObj = {
source: $(document).data("yadcf-filter-" + table_selector_jq_friendly + "-" + column_number),
select: autocompleteSelect
};
if (columnObj.externally_triggered === true) {
delete columnObj.filter_plugin_options.select;
delete autocompleteObj.select;
}
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).autocomplete(columnObj.filter_plugin_options);
if (columnObj.filter_plugin_options !== undefined) {
$.extend(autocompleteObj, columnObj.filter_plugin_options);
}

$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).autocomplete(autocompleteObj);
if (settingsDt.aoPreSearchCols[column_position].sSearch !== '') {
tmpStr = settingsDt.aoPreSearchCols[column_position].sSearch;
tmpStr = yadcfParseMatchFilter(tmpStr, getOptions(oTable.selector)[column_number].filter_match_mode);
Expand Down

0 comments on commit 6c5c002

Please sign in to comment.