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 {
Ox.Log('FIND', 'change form', data.query, pandora.user.ui.find)
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) {
var key = data.selected[0].id;
if (key == 'advanced') {
pandora.$ui.findInput.options({
placeholder: 'Edit Query...',
value: ''
});
that.update();
pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
} else {
Ox.Log('FIND', pandora.$ui.findInput.value())
Ox.Log('FIND', 'select change', pandora.$ui.findInput.value())
pandora.$ui.findInput.options({
autocomplete: autocompleteFunction(),
placeholder: ''
@ -136,6 +133,15 @@ pandora.ui.findElement = function() {
}
} : 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;
};

View file

@ -36,10 +36,10 @@ pandora.ui.mainPanel = function() {
pandora.$ui.filters[i].options({selected: data.selected});
}
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();
} else {
Ox.print(i, 'EQUAL', data.find, previousUI._filterState[i].find)
Ox.Log('FIND', 'EQUAL', data.find, previousUI._filterState[i].find)
}
});
} 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() {
// Note: getFindState has to run after getListState and getFilterState