[ADD] listview padding to 5 visible rows at all time

bzr revid: xmo@openerp.com-20110914150352-jxnom223gdmtys2n
This commit is contained in:
Xavier Morel 2011-09-14 17:03:52 +02:00
parent d12fca41f8
commit c57bb71be1
1 changed files with 25 additions and 0 deletions

View File

@ -775,6 +775,31 @@ openerp.web.ListView.List = openerp.web.Class.extend( /** @lends openerp.web.Lis
this.$current.empty().append(
QWeb.render('ListView.rows', _.extend({
render_cell: openerp.web.format_cell}, this)));
this.pad_table_to(5);
},
pad_table_to: function (count) {
if (this.records.length >= count ||
_(this.columns).any(function(column) { return column.meta; })) {
return;
}
var cells = [];
if (this.options.selectable) {
cells.push('<td title="selection"></td>');
}
_(this.columns).each(function(column) {
if (column.invisible !== '1') {
cells.push('<td title="' + column.string + '">&nbsp;</td>');
}
});
if (this.options.deletable) {
cells.push('<td><button type="button" style="visibility: hidden"> </button></td>');
}
cells.unshift('<tr>');
cells.push('</tr>');
var row = cells.join('');
this.$current.append(new Array(count - this.records.length + 1).join(row));
this.refresh_zebra(this.records.length);
},
/**
* Gets the ids of all currently selected records, if any