when editing advanced query, keep find element in correct state

This commit is contained in:
rolux 2011-11-11 11:08:23 +00:00
parent ee9135bf04
commit 8f41bdc418
4 changed files with 24 additions and 7 deletions

View file

@ -62,6 +62,7 @@ pandora.ui.filterForm = function(list) {
} else { } else {
Ox.Log('FIND', 'change form', data.query, pandora.user.ui.find) Ox.Log('FIND', 'change form', data.query, pandora.user.ui.find)
pandora.UI.set({find: Ox.clone(data.query, true)}); pandora.UI.set({find: Ox.clone(data.query, true)});
pandora.$ui.findElement.update();
} }
} }
}) })

View file

@ -48,13 +48,10 @@ pandora.ui.findElement = function() {
change: function(data) { change: function(data) {
var key = data.selected[0].id; var key = data.selected[0].id;
if (key == 'advanced') { if (key == 'advanced') {
pandora.$ui.findInput.options({ that.update();
placeholder: 'Edit Query...',
value: ''
});
pandora.$ui.filterDialog = pandora.ui.filterDialog().open(); pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
} else { } else {
Ox.Log('FIND', pandora.$ui.findInput.value()) Ox.Log('FIND', 'select change', pandora.$ui.findInput.value())
pandora.$ui.findInput.options({ pandora.$ui.findInput.options({
autocomplete: autocompleteFunction(), autocomplete: autocompleteFunction(),
placeholder: '' placeholder: ''
@ -136,6 +133,15 @@ pandora.ui.findElement = function() {
} }
} : null; } : null;
} }
that.update = function() {
var findState = pandora.user.ui._findState;
pandora.$ui.findSelect.value(findState.key);
pandora.$ui.findInput.options(
findState.key == 'advanced'
? {placeholder: 'Edit Query...', value: ''}
: {placeholder: '', value: findState.value}
);
};
return that; return that;
}; };

View file

@ -36,10 +36,10 @@ pandora.ui.mainPanel = function() {
pandora.$ui.filters[i].options({selected: data.selected}); pandora.$ui.filters[i].options({selected: data.selected});
} }
if (!Ox.isEqual(data.find, previousUI._filterState[i].find)) { if (!Ox.isEqual(data.find, previousUI._filterState[i].find)) {
Ox.print(i, 'NOT EQUAL', data.find, previousUI._filterState[i].find) Ox.Log('FIND', 'NOT EQUAL', data.find, previousUI._filterState[i].find)
pandora.$ui.filters[i].reloadList(); pandora.$ui.filters[i].reloadList();
} else { } else {
Ox.print(i, 'EQUAL', data.find, previousUI._filterState[i].find) Ox.Log('FIND', 'EQUAL', data.find, previousUI._filterState[i].find)
} }
}); });
} else { } else {

View file

@ -974,6 +974,16 @@ pandora.unloadWindow = function() {
*/ */
}; };
pandora.updateFindElement = function() {
var findState = pandora.user.ui._findState;
pandora.$ui.findSelect.value(findState.key);
pandora.$ui.findInput.options(
findState.key == 'advanced'
? {placeholder: 'Edit Query...', value: ''}
: {placeholder: '', value: findState.value}
);
};
(function() { (function() {
// Note: getFindState has to run after getListState and getFilterState // Note: getFindState has to run after getListState and getFilterState