make find clear button work as expected if find is advanced

This commit is contained in:
rolux 2012-02-19 16:29:34 +00:00
parent 5204fc6521
commit 319a17d954

View file

@ -3,7 +3,8 @@
pandora.ui.findElement = function() { 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;
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({
@ -69,8 +70,16 @@ pandora.ui.findElement = function() {
width: 192 width: 192
}) })
.bindEvent({ .bindEvent({
clear: function() {
hasPressedClear = true;
},
focus: function(data) { focus: function(data) {
if (pandora.$ui.findSelect.value() == 'advanced') { if (pandora.$ui.findSelect.value() == 'advanced') {
if (hasPressedClear) {
pandora.UI.set({find: pandora.site.user.ui.find});
that.update();
hasPressedClear = false;
}
pandora.$ui.findInput.blurInput(); pandora.$ui.findInput.blurInput();
pandora.$ui.filterDialog = pandora.ui.filterDialog().open(); pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
} }