fix double reloading of lists

This commit is contained in:
Rolux 2016-01-08 09:41:22 +05:30
parent eec35c1eec
commit a765f52f8a
1 changed files with 16 additions and 10 deletions

View File

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