[FIX]Fixe the issue of listview record re-ordering which is not working due to revision 3898.

bzr revid: msh@openerp.com-20130509085102-ln4lidp7caqw25ur
This commit is contained in:
Mohammed Shekha 2013-05-09 14:21:02 +05:30
parent f97d0b48e5
commit d8dd8fc14b
2 changed files with 6 additions and 1 deletions

View File

@ -610,6 +610,9 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin,
remove_ids: function (ids) {
this.alter_ids(_(this.ids).difference(ids));
},
add_ids: function(ids) {
this.alter_ids(_(this.ids).union(ids));
},
/**
* Resequence records.
*

View File

@ -896,7 +896,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
this.record_callbacks = {
'remove': function (event, record) {
var id = record.get('id');
self.dataset.remove_ids([id])
self.dataset.remove_ids([id]);
var $row = self.$current.children('[data-id=' + id + ']');
var index = $row.data('index');
$row.remove();
@ -925,6 +925,8 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
},
'add': function (ev, records, record, index) {
var $new_row = $(self.render_record(record));
var id = record.get('id');
self.dataset.add_ids([id]);
if (index === 0) {
$new_row.prependTo(self.$current);