sync find select and find menu (fixes #591)

This commit is contained in:
rolux 2012-03-18 15:11:16 +00:00
parent 4ad4962d33
commit 364c9b004a
2 changed files with 9 additions and 3 deletions

View file

@ -4,7 +4,8 @@ pandora.ui.findElement = function() {
var findIndex = pandora.user.ui._findState.index, var findIndex = pandora.user.ui._findState.index,
findKey = pandora.user.ui._findState.key, findKey = pandora.user.ui._findState.key,
findValue = pandora.user.ui._findState.value, findValue = pandora.user.ui._findState.value,
hasPressedClear = false; hasPressedClear = false,
previousFindKey = findKey;
var that = Ox.FormElementGroup({ var that = Ox.FormElementGroup({
elements: Ox.merge(pandora.user.ui._list ? [ elements: Ox.merge(pandora.user.ui._list ? [
pandora.$ui.findListSelect = Ox.Select({ pandora.$ui.findListSelect = Ox.Select({
@ -48,7 +49,7 @@ pandora.ui.findElement = function() {
change: function(data) { change: function(data) {
if (data.value == 'advanced') { if (data.value == 'advanced') {
that.update(); that.update();
// fixme: uncheck menu item! pandora.$ui.mainMenu.checkItem('findMenu_find_' + previousFindKey);
pandora.$ui.filterDialog = pandora.ui.filterDialog().open(); pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
} else { } else {
pandora.$ui.mainMenu.checkItem('findMenu_find_' + data.value); pandora.$ui.mainMenu.checkItem('findMenu_find_' + data.value);
@ -56,6 +57,7 @@ pandora.ui.findElement = function() {
autocomplete: autocompleteFunction(), autocomplete: autocompleteFunction(),
placeholder: '' placeholder: ''
}).focusInput(true); }).focusInput(true);
previousFindKey = data.value;
} }
} }
}), }),

View file

@ -175,9 +175,14 @@ pandora.ui.mainMenu = function() {
} else if (data.id == 'find') { } else if (data.id == 'find') {
if (value) { if (value) {
pandora.$ui.findSelect.value(value); pandora.$ui.findSelect.value(value);
if (pandora.user.ui._findState.key == 'advanced') {
// fixme: autocomplete function doesn't get updated
pandora.$ui.findInput.options({placeholder: ''});
}
} else { } else {
that.checkItem('findMenu_find_' + pandora.$ui.findSelect.value()); that.checkItem('findMenu_find_' + pandora.$ui.findSelect.value());
} }
pandora.$ui.findInput.focusInput(true);
} else if (data.id == 'itemview') { } else if (data.id == 'itemview') {
pandora.UI.set({itemView: value}); pandora.UI.set({itemView: value});
} else if (data.id == 'listview') { } else if (data.id == 'listview') {
@ -235,7 +240,6 @@ pandora.ui.mainMenu = function() {
) { ) {
set.itemView = value; set.itemView = value;
} }
Ox.print('SET', set)
pandora.UI.set(set); pandora.UI.set(set);
} else if (data.id == 'viewicons') { } else if (data.id == 'viewicons') {
pandora.UI.set({icons: value}); pandora.UI.set({icons: value});