From 59b5a6d8b204f86aacf7ea73f586100a5f771799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 31 Oct 2016 22:50:52 +0100 Subject: [PATCH] Grow multiselection widget to show all items if yexpand is not set When there are few options, the widget is often used with no yexpand to look like a normal field. But in this case, some options could be not visible and user could miss them. issue5994 review33571002 --- src/view/form.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/view/form.js b/src/view/form.js index 30dc3e7090..4af3587a9a 100644 --- a/src/view/form.js +++ b/src/view/form.js @@ -3311,6 +3311,7 @@ function eval_pyson(value){ Sao.View.Form.MultiSelection = Sao.class_(Sao.View.Form.Selection, { class_: 'form-multiselection', + expand: true, init: function(field_name, model, attributes) { this.nullable_widget = false; Sao.View.Form.MultiSelection._super.init.call(this, field_name, @@ -3320,6 +3321,13 @@ function eval_pyson(value){ display_update_selection: function(record, field) { var i, len, element; this.update_selection(record, field, function() { + var yexpand = this.attributes.yexpand; + if (yexpand === undefined) { + yexpand = this.expand; + } + if (!yexpand) { + this.select.prop('size', this.select.children().length); + } if (!field) { return; }