[FIX] insertion position of new lines (in editable lists) in case of lists padded to 5 (empty) lines
bzr revid: xmo@openerp.com-20111004154246-7o1cw016cf9ygem3
This commit is contained in:
parent
f164496dc4
commit
72b852c2c6
|
@ -815,7 +815,9 @@ openerp.web.ListView.List = openerp.web.Class.extend( /** @lends openerp.web.Lis
|
|||
cells.push('</tr>');
|
||||
|
||||
var row = cells.join('');
|
||||
this.$current.append(new Array(count - this.records.length + 1).join(row));
|
||||
this.$current
|
||||
.find('> tr:not([data-id])').remove().end()
|
||||
.append(new Array(count - this.records.length + 1).join(row));
|
||||
this.refresh_zebra(this.records.length);
|
||||
},
|
||||
/**
|
||||
|
|
|
@ -120,6 +120,7 @@ openerp.web.list_editable = function (openerp) {
|
|||
delete self.edition_id;
|
||||
delete self.edition;
|
||||
});
|
||||
this.pad_table_to(5);
|
||||
return cancelled.promise();
|
||||
},
|
||||
/**
|
||||
|
@ -173,10 +174,18 @@ openerp.web.list_editable = function (openerp) {
|
|||
});
|
||||
if (row) {
|
||||
$new_row.replaceAll(row);
|
||||
} else if (self.options.editable === 'top') {
|
||||
self.$current.prepend($new_row);
|
||||
} else if (self.options.editable) {
|
||||
self.$current.append($new_row);
|
||||
if (self.options.editable === 'top') {
|
||||
$new_row.insertBefore(
|
||||
self.$current.find('> [data-id]:first'));
|
||||
} else {
|
||||
$new_row.insertAfter(
|
||||
self.$current.find('> [data-id]:last'));
|
||||
}
|
||||
var $last_child = self.$current.find('> tr:last');
|
||||
if ($last_child.is(':not([data-id])')) {
|
||||
$last_child.remove();
|
||||
}
|
||||
}
|
||||
self.edition = true;
|
||||
self.edition_id = record_id;
|
||||
|
|
Loading…
Reference in New Issue