diff options
| author | Mohammed Shekha <msh@openerp.com> | 2013-06-06 12:26:30 +0530 |
|---|---|---|
| committer | Mohammed Shekha <msh@openerp.com> | 2013-06-06 12:26:30 +0530 |
| commit | 2b65ba1f64669efe2ec6362a18f26a2a1a7d08aa (patch) | |
| tree | b50e90e7c32e975f57abbd727d451a6e63637db9 | |
| parent | d72773015e60be3ba0bbe1dd43997019611f2505 (diff) | |
| parent | d8dd8fc14bda8e3888a1580b9e344754b862f558 (diff) | |
[FIX]Refixed the issue of resequence, added id at specified index in dataset.
bzr revid: msh@openerp.com-20130606065630-r536yqlcq0wihs8l
| -rw-r--r-- | addons/web/static/src/js/data.js | 4 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_list.js | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index f7dd6d2ca4f..44567c7ff43 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -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 self = this; + _.each(ids, function(id){ self.ids.splice(at, 0, id); }); + }, /** * Resequence records. * diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index b96079d2051..76831be82fa 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -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], index); if (index === 0) { $new_row.prependTo(self.$current); |
