forked from 0x2620/pandora
don't make filter requests (a total of 15) when filters are collapsed
This commit is contained in:
parent
778c98625a
commit
ad7b21fbef
3 changed files with 24 additions and 9 deletions
|
@ -39,6 +39,13 @@ pandora.ui.browser = function() {
|
||||||
toggle: function(data) {
|
toggle: function(data) {
|
||||||
data.collapsed && pandora.$ui.list.gainFocus();
|
data.collapsed && pandora.$ui.list.gainFocus();
|
||||||
pandora.UI.set({showFilters: !data.collapsed});
|
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') {
|
if (pandora.user.ui.listView == 'map') {
|
||||||
pandora.$ui.map.resizeMap();
|
pandora.$ui.map.resizeMap();
|
||||||
} else if (pandora.user.ui.listView == 'calendar') {
|
} else if (pandora.user.ui.listView == 'calendar') {
|
||||||
|
|
|
@ -7,6 +7,7 @@ pandora.ui.filter = function(id) {
|
||||||
title = Ox.getObjectById(pandora.site.filters, id).title,
|
title = Ox.getObjectById(pandora.site.filters, id).title,
|
||||||
//width = pandora.getFilterWidth(i, panelWidth),
|
//width = pandora.getFilterWidth(i, panelWidth),
|
||||||
that = Ox.TextList({
|
that = Ox.TextList({
|
||||||
|
_reload: !pandora.user.ui.showFilters,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -58,15 +59,15 @@ pandora.ui.filter = function(id) {
|
||||||
columnsVisible: true,
|
columnsVisible: true,
|
||||||
id: 'filter_' + id,
|
id: 'filter_' + id,
|
||||||
items: function(data, callback) {
|
items: function(data, callback) {
|
||||||
//if (pandora.user.ui.showFilters) {
|
if (pandora.user.ui.showFilters) {
|
||||||
delete data.keys;
|
delete data.keys;
|
||||||
return pandora.api.find(Ox.extend(data, {
|
return pandora.api.find(Ox.extend(data, {
|
||||||
group: id,
|
group: id,
|
||||||
query: pandora.user.ui._filterState[i].find
|
query: pandora.user.ui._filterState[i].find
|
||||||
}), callback);
|
}), callback);
|
||||||
//} else {
|
} else {
|
||||||
// callback({data: {items: data.keys ? [] : 0}});
|
callback({data: {items: data.keys ? [] : 0}});
|
||||||
//}
|
}
|
||||||
},
|
},
|
||||||
scrollbarVisible: true,
|
scrollbarVisible: true,
|
||||||
selected: pandora.user.ui._filterState[i].selected,
|
selected: pandora.user.ui._filterState[i].selected,
|
||||||
|
|
|
@ -36,13 +36,20 @@ pandora.ui.mainPanel = function() {
|
||||||
// FIXME: why is this being handled _here_?
|
// FIXME: why is this being handled _here_?
|
||||||
pandora.user.ui._filterState.forEach(function(data, i) {
|
pandora.user.ui._filterState.forEach(function(data, i) {
|
||||||
if (!Ox.isEqual(data.selected, previousUI._filterState[i].selected)) {
|
if (!Ox.isEqual(data.selected, previousUI._filterState[i].selected)) {
|
||||||
|
if (pandora.user.ui.showFilters) {
|
||||||
pandora.$ui.filters[i].options({selected: data.selected});
|
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)) {
|
if (!Ox.isEqual(data.find, previousUI._filterState[i].find)) {
|
||||||
Ox.Log('FIND', 'NOT EQUAL', data.find, previousUI._filterState[i].find)
|
if (pandora.user.ui.showFilters) {
|
||||||
pandora.$ui.filters[i].reloadList();
|
pandora.$ui.filters[i].reloadList();
|
||||||
} else {
|
} else {
|
||||||
Ox.Log('FIND', 'EQUAL', data.find, previousUI._filterState[i].find)
|
// 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 {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue