fix double reloading of lists

This commit is contained in:
Rolux 2016-01-08 09:41:22 +05:30
parent eec35c1eec
commit a765f52f8a

View file

@ -97,7 +97,11 @@ oml.ui.list = function() {
}, },
paste: function(data) { paste: function(data) {
var items = oml.clipboard.paste(); var items = oml.clipboard.paste();
if (items.length && oml.clipboard.type() == 'book' && oml.getListData().editable) { if (
items.length
&& oml.clipboard.type() == 'book'
&& oml.getListData().editable
) {
oml.doHistory('paste', items, ui._list, function() { oml.doHistory('paste', items, ui._list, function() {
oml.UI.set({listSelection: items}); oml.UI.set({listSelection: items});
oml.reloadList(); oml.reloadList();
@ -113,16 +117,18 @@ oml.ui.list = function() {
}, },
oml_find: function() { oml_find: function() {
if (ui.listView == oml.UI.getPrevious().listView) { if (ui.listView == oml.UI.getPrevious().listView) {
if (JSON.stringify(ui.listSort) == JSON.stringify(oml.UI.getPrevious().listSort)) { if (
that.reloadList(); JSON.stringify(ui.listSort)
} else { != JSON.stringify(oml.UI.getPrevious().listSort)
//fixme: this reloads list twice. ) {
//just setting sort will not update number of items /*
that.options({ that.options({sort: ...}) would already reload
sort: Ox.clone(ui.listSort, true) the list, but not update the number of items
}); */
that.reloadList(); var options = that.options();
options.sort = Ox.clone(ui.listSort, true);
} }
that.reloadList();
} }
}, },
oml_item: function() { oml_item: function() {