bugfix for find element

This commit is contained in:
rlx 2011-01-15 14:40:47 +00:00
parent c8aa818fed
commit fd84824ca7

View file

@ -704,37 +704,46 @@ var pandora = new Ox.App({
id: 'input', id: 'input',
width: 192 width: 192
}) })
.bindEvent('submit', function(event, data) { .bindEvent({
var key = app.user.ui.findQuery.conditions.length ? submit: function(event, data) {
app.user.ui.findQuery.conditions[0].key : '', var key = app.user.ui.findQuery.conditions.length ?
query; app.user.ui.findQuery.conditions[0].key : '',
app.user.ui.findQuery.conditions = [ query;
{ if (that.value()[0].id == 'all') { // fixme: ambiguous?
key: key == 'all' ? '' : key, app.$ui.sectionList.forEach(function($list) {
value: data.value, $list.options({selected: []});
operator: '' }); // fixme: doesn't cover complex lists
app.user.ui.list = '';
app.user.ui.listQuery = {conditions: [], operator: ''};
} }
]; app.user.ui.findQuery.conditions = [
$.each(app.ui.groups, function(i, group) { {
group.query.conditions = []; key: key == 'all' ? '' : key,
app.$ui.groups[i].options({ value: data.value,
operator: ''
}
];
$.each(app.ui.groups, function(i, group) {
group.query.conditions = [];
app.$ui.groups[i].options({
request: function(data, callback) {
delete data.keys;
return pandora.api.find($.extend(data, {
group: group.id,
query: Query.toObject(group.id)
}), callback);
}
});
});
app.$ui.list.options({
request: function(data, callback) { request: function(data, callback) {
delete data.keys;
return pandora.api.find($.extend(data, { return pandora.api.find($.extend(data, {
group: group.id, query: query = Query.toObject()
query: Query.toObject(group.id)
}), callback); }), callback);
} }
}); });
}); history.pushState({}, '', '/' + Query.toString(query));
app.$ui.list.options({ }
request: function(data, callback) {
return pandora.api.find($.extend(data, {
query: query = Query.toObject()
}), callback);
}
});
history.pushState({}, '', '/' + Query.toString(query));
}) })
]), ]),
id: 'findElement' id: 'findElement'