handle filter selection when filters are collapsed on load, fixes #776
This commit is contained in:
parent
6b5cc45728
commit
1dfcd9698d
3 changed files with 31 additions and 15 deletions
|
@ -41,8 +41,16 @@ pandora.ui.browser = function() {
|
||||||
pandora.UI.set({showFilters: !data.collapsed});
|
pandora.UI.set({showFilters: !data.collapsed});
|
||||||
if (!data.collapsed) {
|
if (!data.collapsed) {
|
||||||
pandora.$ui.filters.forEach(function($filter) {
|
pandora.$ui.filters.forEach(function($filter) {
|
||||||
if ($filter.options('_reload')) {
|
var selected = $filter.options('_selected');
|
||||||
$filter.options({_reload: false}).reloadList();
|
if (selected) {
|
||||||
|
$filter.bindEventOnce({
|
||||||
|
load: function() {
|
||||||
|
$filter.options({
|
||||||
|
_selected: false,
|
||||||
|
selected: selected
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).reloadList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,9 @@ 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,
|
_selected: !pandora.user.ui.showFilters
|
||||||
|
? pandora.user.ui._filterState[i].selected
|
||||||
|
: false,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -70,7 +72,9 @@ pandora.ui.filter = function(id) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
scrollbarVisible: true,
|
scrollbarVisible: true,
|
||||||
selected: pandora.user.ui._filterState[i].selected,
|
selected: pandora.user.ui.showFilters
|
||||||
|
? pandora.user.ui._filterState[i].selected
|
||||||
|
: [],
|
||||||
sort: [{
|
sort: [{
|
||||||
key: pandora.user.ui.filters[i].sort[0].key,
|
key: pandora.user.ui.filters[i].sort[0].key,
|
||||||
operator: pandora.user.ui.filters[i].sort[0].operator
|
operator: pandora.user.ui.filters[i].sort[0].operator
|
||||||
|
|
|
@ -37,20 +37,24 @@ 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(
|
||||||
pandora.$ui.filters[i].options({selected: data.selected});
|
pandora.user.ui.showFilters ? {
|
||||||
} else {
|
selected: data.selected
|
||||||
pandora.$ui.filters[i].options({_reload: true, selected: []});
|
} : {
|
||||||
}
|
_selected: data.selected,
|
||||||
|
selected: []
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (!Ox.isEqual(data.find, previousUI._filterState[i].find)) {
|
if (!Ox.isEqual(data.find, previousUI._filterState[i].find)) {
|
||||||
if (pandora.user.ui.showFilters) {
|
if (!pandora.user.ui.showFilters) {
|
||||||
pandora.$ui.filters[i].reloadList();
|
pandora.$ui.filters[i].options({
|
||||||
} else {
|
_selected: data.selected
|
||||||
// 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();
|
|
||||||
}
|
}
|
||||||
|
// we can call reloadList here, since the items function
|
||||||
|
// handles the hidden filters case without making requests
|
||||||
|
pandora.$ui.filters[i].reloadList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue