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
This commit is contained in:
Cédric Krier
2016-10-31 22:50:52 +01:00
parent 24b522c7fc
commit 59b5a6d8b2
+8
View File
@@ -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;
}