[FIX] make the field text resize correctly

lp bug: https://launchpad.net/bugs/1089447 fixed

bzr revid: nicolas.vanhoren@openerp.com-20121213150653-slmic4hcc2m95xy0
This commit is contained in:
niv-openerp 2012-12-13 16:06:53 +01:00
parent 80133457d9
commit 8a3fe9f0c2
1 changed files with 7 additions and 2 deletions

View File

@ -2544,6 +2544,7 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we
initialize_content: function() {
var self = this;
this.$textarea = this.$el.find('textarea');
this.auto_sized = false;
this.default_height = this.$textarea.css('height');
if (this.get("effective_readonly")) {
this.$textarea.attr('disabled', 'disabled');
@ -2563,13 +2564,17 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we
}
},
render_value: function() {
$(window).resize();
var show_value = instance.web.format_value(this.get('value'), this, '');
if (show_value === '') {
this.$textarea.css('height', parseInt(this.default_height)+"px");
}
this.$textarea.val(show_value);
this.$textarea.autosize();
if (! this.auto_sized) {
this.auto_sized = true;
this.$textarea.autosize();
} else {
this.$textarea.trigger("autosize");
}
},
is_syntax_valid: function() {
if (!this.get("effective_readonly") && this.$textarea) {