update results view

This commit is contained in:
j 2010-06-30 10:44:26 +02:00
parent 802cba4c77
commit ec7aa8a388

View file

@ -69,7 +69,7 @@ $(function(){
] ]
}, },
list: 'all', list: 'all',
sort: field, sort: [{key:field, operator: ''}],
keys: [field], keys: [field],
range: [0, 10] range: [0, 10]
}, function(result) { }, function(result) {
@ -448,12 +448,13 @@ $(function(){
} }
}); });
*/ */
var loadResult = function(find) { var loadResult = function(query) {
var columns = [ { var columns = [ {
align: "left", align: "left",
id: "title", id: "title",
operator: "+", operator: "+",
title: "Title", title: "Title",
visible: true,
width: 160 width: 160
}, },
{ {
@ -461,6 +462,7 @@ $(function(){
id: "director", id: "director",
operator: "+", operator: "+",
title: "Director", title: "Director",
visible: true,
width: 160 width: 160
}, },
{ {
@ -468,46 +470,38 @@ $(function(){
id: "year", id: "year",
operator: "-", operator: "-",
title: "Year", title: "Year",
visible: true,
width: 80 width: 80
} }
]; ];
if(find.key=='country') {
columns[columns.length] = {
align: "right",
id: "country",
operator: "+",
title: "Country",
width: 80
};
}
return new Ox.TextList({ return new Ox.TextList({
columns: columns, columns: columns,
request: function(options) { request: function(options) {
app.request("find", $.extend(options, { app.request("find", $.extend(options, {
query: { query: query
conditions: [
{
key: find.key,
value: find.value,
operator: "="
}
],
operator: "&"
}
}), options.callback); }), options.callback);
}, },
sort: { sort: [{
key: "year", key: "year",
operator: "-" operator: "-"
} }]
}); });
} }
var results = loadResult({value:'', key:'title'}).appendTo(content); var results = loadResult({
conditions: [],
operator: "&"
}).appendTo(content);
Ox.Event.bind(false, 'submit_find', function(event, data) { Ox.Event.bind(false, 'submit_find', function(event, data) {
var r = loadResult({ var r = loadResult({
'value': data.value, conditions: [
'key': data.option.substr(6).toLowerCase() {
key: data.option.substr(6).toLowerCase(),
value: data.value,
operator: "~"
}
],
operator: "&"
}); });
results.replaceWith(r); results.replaceWith(r);
results = r; results = r;