summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2014-11-07 09:46:11 +0100
committerGéry Debongnie <ged@odoo.com>2014-11-12 09:26:30 +0100
commit16b26e3883f37ec8b0a7111146a212ffc8bb66ad (patch)
tree6d5717d7a83a8e4e85c164d1e96d9a004791c216 /addons/web/static/src/js
parent30e21de532aa1caa97cfbe566d068fb31355d76c (diff)
[FIX] add scrollbar to filters menu if needed (web client)
the filters menu can quickly grow if the user adds many conditions. Once it grows out of the screen, the lower buttons can not be reached anymore. This patch adds a vertical scrollbar to fix this issue. It has to use some javascript to update its max-height property.
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/search.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index defee864295..29f4657b7ea 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -1441,6 +1441,10 @@ instance.web.search.FilterMenu = instance.web.Widget.extend({
prop.$el.hide();
});
},
+ update_max_height: function () {
+ var max_height = $(window).height() - this.$menu[0].getBoundingClientRect().top - 10;
+ this.$menu.css('max-height', max_height);
+ },
toggle_custom_filter_menu: function (is_open) {
this.$add_filter
.toggleClass('closed-menu', !is_open)
@@ -1450,6 +1454,7 @@ instance.web.search.FilterMenu = instance.web.Widget.extend({
this.append_proposition();
}
this.$('.oe-filter-condition').toggle(is_open);
+ this.update_max_height();
},
append_proposition: function () {
var self = this;
@@ -1458,6 +1463,7 @@ instance.web.search.FilterMenu = instance.web.Widget.extend({
self.propositions.push(prop);
prop.insertBefore(self.$add_filter_menu);
self.$apply_filter.prop('disabled', false);
+ self.update_max_height();
return prop;
});
},