diff options
| author | Mathieu Duckerts-Antoine <dam@odoo.com> | 2018-08-07 11:57:22 +0200 |
|---|---|---|
| committer | Mathieu Duckerts-Antoine <dam@odoo.com> | 2018-08-14 12:37:44 +0200 |
| commit | ad0a758b75112dd0e934e04e79a13cdacd6ebbd0 (patch) | |
| tree | 9c136530e6123675d305dfc5c532360adb9a0dde /addons/web/static/src/js/widgets | |
| parent | 89931d1749e35231cc054428e1c43801d5ef3ffa (diff) | |
[FIX] web: autocompletion in the new search view
A lot of new features have been implemented in search view
but autocompletion was forgotten. This commit fixes many
small problems that were introduced:
- synchronization of facets created through
autocompletion with filters and groupby menus
- filters created through autocompletion can be saved
Diffstat (limited to 'addons/web/static/src/js/widgets')
| -rw-r--r-- | addons/web/static/src/js/widgets/dropdown_menu.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/addons/web/static/src/js/widgets/dropdown_menu.js b/addons/web/static/src/js/widgets/dropdown_menu.js index 6f8f78a13d5..fdab9b82ebf 100644 --- a/addons/web/static/src/js/widgets/dropdown_menu.js +++ b/addons/web/static/src/js/widgets/dropdown_menu.js @@ -66,14 +66,18 @@ var DropdownMenu = Widget.extend({ //-------------------------------------------------------------------------- /** - * @param {Number[]} groupIds + * @param {string[]} activeItemIds */ - unsetGroups: function (groupIds) { - var self = this; - _.each(self.items, function (item) { - if (_.contains(groupIds, item.groupId)) { + updateItemsStatus: function (activeItemIds) { + _.each(this.items, function (item) { + if (!_.contains(activeItemIds, item.itemId)) { item.isActive = false; item.currentOptionId = false; + } else { + item.isActive = true; + item.currentOptionId = item.hasOptions ? + (item.currentOptionId || item.defaultOptionId) : + false; } }); this._renderMenuItems(); @@ -122,7 +126,8 @@ var DropdownMenu = Widget.extend({ if (item.options && item.options.length !== 0) { item.options = _.sortBy(item.options, 'groupId'); item.hasOptions = true; - item.currentOptionId = item.isActive && item.currentOptionId ? item.currentOptionId : false; + item.defaultOptionId = item.defaultOptionId || this.defaultOptionId; + item.currentOptionId = item.isActive && item.defaultOptionId ? item.defaultOptionId : false; } }, /** |
