[IMP] correctly reinsert ids into dataset when moving them around in the list view
bzr revid: xmo@openerp.com-20130607120355-x3poxy2ar2bpqqvw
This commit is contained in:
commit
8d0d43b40b
|
@ -625,6 +625,10 @@ 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, at) {
|
||||
var args = [at, 0].concat(ids);
|
||||
this.ids.splice.apply(this.ids, args);
|
||||
},
|
||||
/**
|
||||
* Resequence records.
|
||||
*
|
||||
|
|
|
@ -893,7 +893,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();
|
||||
|
@ -922,6 +922,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], index);
|
||||
|
||||
if (index === 0) {
|
||||
$new_row.prependTo(self.$current);
|
||||
|
|
Loading…
Reference in New Issue