[FIX] records disappearing from sequenceable list views when dropped onto their original position
In the listview's backing Records, a noop set (setting a property to the value it already has) has no visible effect (no even is triggered, it is simply ignored). The listview relies on setting the sequence number to refresh records and re-display them correctly in their table rows, but dropping an already sequenced row onto itself would set its sequence to its current value (barring record removals), yielding to no refresh and the row simply poofing out of view as it gets removed from the collection (and the table), then added back to the collection in its new (and old) position and displayed in a bare-bones empty states waiting for a render_record call. Added a check to sorting management to bail out immediately if a sort is a noop (the row is dropped at the same position it was taken from) lp bug: https://launchpad.net/bugs/900207 fixed bzr revid: xmo@openerp.com-20111206123735-4bfnqh1zl7u4ozm9
This commit is contained in:
parent
ee6841e510
commit
c58ebcfaed
|
@ -1281,10 +1281,15 @@ openerp.web.ListView.Groups = openerp.web.Class.extend( /** @lends openerp.web.L
|
|||
items: '> tr[data-id]',
|
||||
stop: function (event, ui) {
|
||||
var to_move = list.records.get(ui.item.data('id')),
|
||||
target_id = ui.item.prev().data('id');
|
||||
target_id = ui.item.prev().data('id'),
|
||||
from_index = list.records.indexOf(to_move),
|
||||
target = list.records.get(target_id);
|
||||
if (list.records.at(from_index - 1) == target) {
|
||||
return;
|
||||
}
|
||||
|
||||
list.records.remove(to_move);
|
||||
var to = target_id ? list.records.indexOf(list.records.get(target_id)) + 1 : 0;
|
||||
var to = target_id ? list.records.indexOf(target) + 1 : 0;
|
||||
list.records.add(to_move, { at: to });
|
||||
|
||||
// resequencing time!
|
||||
|
|
Loading…
Reference in New Issue