diff --git a/static/js/pandora/browser.js b/static/js/pandora/browser.js index e343e4f3..06ecdc59 100644 --- a/static/js/pandora/browser.js +++ b/static/js/pandora/browser.js @@ -41,8 +41,16 @@ pandora.ui.browser = function() { pandora.UI.set({showFilters: !data.collapsed}); if (!data.collapsed) { pandora.$ui.filters.forEach(function($filter) { - if ($filter.options('_reload')) { - $filter.options({_reload: false}).reloadList(); + var selected = $filter.options('_selected'); + if (selected) { + $filter.bindEventOnce({ + load: function() { + $filter.options({ + _selected: false, + selected: selected + }); + } + }).reloadList(); } }); } diff --git a/static/js/pandora/filter.js b/static/js/pandora/filter.js index ff29f03c..f1e1facc 100644 --- a/static/js/pandora/filter.js +++ b/static/js/pandora/filter.js @@ -7,7 +7,9 @@ pandora.ui.filter = function(id) { title = Ox.getObjectById(pandora.site.filters, id).title, //width = pandora.getFilterWidth(i, panelWidth), that = Ox.TextList({ - _reload: !pandora.user.ui.showFilters, + _selected: !pandora.user.ui.showFilters + ? pandora.user.ui._filterState[i].selected + : false, columns: [ { align: 'left', @@ -70,7 +72,9 @@ pandora.ui.filter = function(id) { } }, scrollbarVisible: true, - selected: pandora.user.ui._filterState[i].selected, + selected: pandora.user.ui.showFilters + ? pandora.user.ui._filterState[i].selected + : [], sort: [{ key: pandora.user.ui.filters[i].sort[0].key, operator: pandora.user.ui.filters[i].sort[0].operator diff --git a/static/js/pandora/mainPanel.js b/static/js/pandora/mainPanel.js index 3d251812..67e0f1a1 100644 --- a/static/js/pandora/mainPanel.js +++ b/static/js/pandora/mainPanel.js @@ -37,20 +37,24 @@ pandora.ui.mainPanel = function() { // FIXME: why is this being handled _here_? pandora.user.ui._filterState.forEach(function(data, i) { if (!Ox.isEqual(data.selected, previousUI._filterState[i].selected)) { - if (pandora.user.ui.showFilters) { - pandora.$ui.filters[i].options({selected: data.selected}); - } else { - pandora.$ui.filters[i].options({_reload: true, selected: []}); - } + pandora.$ui.filters[i].options( + pandora.user.ui.showFilters ? { + selected: data.selected + } : { + _selected: data.selected, + selected: [] + } + ); } if (!Ox.isEqual(data.find, previousUI._filterState[i].find)) { - if (pandora.user.ui.showFilters) { - pandora.$ui.filters[i].reloadList(); - } else { - // we can call reloadList here, since the items function - // handles the hidden filters case without making requests - pandora.$ui.filters[i].options({_reload: true}).reloadList(); + if (!pandora.user.ui.showFilters) { + pandora.$ui.filters[i].options({ + _selected: data.selected + }); } + // we can call reloadList here, since the items function + // handles the hidden filters case without making requests + pandora.$ui.filters[i].reloadList(); } }); } else {