diff --git a/static/js/pandora/browser.js b/static/js/pandora/browser.js index bd0743214..e343e4f3a 100644 --- a/static/js/pandora/browser.js +++ b/static/js/pandora/browser.js @@ -39,6 +39,13 @@ pandora.ui.browser = function() { toggle: function(data) { data.collapsed && pandora.$ui.list.gainFocus(); pandora.UI.set({showFilters: !data.collapsed}); + if (!data.collapsed) { + pandora.$ui.filters.forEach(function($filter) { + if ($filter.options('_reload')) { + $filter.options({_reload: false}).reloadList(); + } + }); + } if (pandora.user.ui.listView == 'map') { pandora.$ui.map.resizeMap(); } else if (pandora.user.ui.listView == 'calendar') { diff --git a/static/js/pandora/filter.js b/static/js/pandora/filter.js index 76633657a..ff29f03cb 100644 --- a/static/js/pandora/filter.js +++ b/static/js/pandora/filter.js @@ -7,6 +7,7 @@ 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, columns: [ { align: 'left', @@ -58,15 +59,15 @@ pandora.ui.filter = function(id) { columnsVisible: true, id: 'filter_' + id, items: function(data, callback) { - //if (pandora.user.ui.showFilters) { + if (pandora.user.ui.showFilters) { delete data.keys; return pandora.api.find(Ox.extend(data, { group: id, query: pandora.user.ui._filterState[i].find }), callback); - //} else { - // callback({data: {items: data.keys ? [] : 0}}); - //} + } else { + callback({data: {items: data.keys ? [] : 0}}); + } }, scrollbarVisible: true, selected: pandora.user.ui._filterState[i].selected, diff --git a/static/js/pandora/mainPanel.js b/static/js/pandora/mainPanel.js index a3f11de1f..64fd08279 100644 --- a/static/js/pandora/mainPanel.js +++ b/static/js/pandora/mainPanel.js @@ -36,13 +36,20 @@ 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)) { - pandora.$ui.filters[i].options({selected: data.selected}); + if (pandora.user.ui.showFilters) { + pandora.$ui.filters[i].options({selected: data.selected}); + } else { + pandora.$ui.filters[i].options({_reload: true, selected: []}); + } } if (!Ox.isEqual(data.find, previousUI._filterState[i].find)) { - Ox.Log('FIND', 'NOT EQUAL', data.find, previousUI._filterState[i].find) - pandora.$ui.filters[i].reloadList(); - } else { - Ox.Log('FIND', 'EQUAL', 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(); + } } }); } else {