[IMP] don't wait for the bloody record to be fully loaded to fixup cell styles and add groupby columns (in case of grouping), it makes the list titles jittery which looks terrible. Instead, can fixup the row right after rendering, which makes the whole thing much stabler

bzr revid: xmo@openerp.com-20110608135141-g6rz1g77ykyg2cja
This commit is contained in:
Xavier Morel 2011-06-08 15:51:41 +02:00
parent f824cd6aa3
commit a905ab7f17
1 changed files with 16 additions and 19 deletions

View File

@ -158,26 +158,23 @@ openerp.base.list.editable = function (openerp) {
template: 'ListView.row.form',
registry: openerp.base.list.form.widgets
});
this.edition_form.on_loaded({fields_view: this.get_fields_view()});
this.edition_form.on_record_loaded.add({
position: 'last',
unique: true,
callback: function () {
var $e = self.edition_form.$element;
$e.find('td')
.addClass('oe-field-cell')
.removeAttr('width')
.end()
.find('td:first').removeClass('oe-field-cell').end()
.find('td:last').removeClass('oe-field-cell').end();
_(self.columns).each(function (column) {
if (column.meta) {
$e.prepend('<td>');
}
});
}
$.when(this.edition_form.on_loaded({fields_view: this.get_fields_view()})).then(function () {
// put in $.when just in case FormView.on_loaded becomes asynchronous
$new_row.find('td')
.addClass('oe-field-cell')
.removeAttr('width')
.end()
.find('td:first').removeClass('oe-field-cell').end()
.find('td:last').removeClass('oe-field-cell').end();
// pad in case of groupby
_(self.columns).each(function (column) {
if (column.meta) {
$new_row.prepend('<td>');
}
});
self.edition_form.do_show();
});
this.edition_form.do_show();
},
/**
* Saves the current row, and triggers the edition of its following