From 1770c908cd03d0bd7efe10847e32b4b5a008f17b Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 28 Jun 2010 09:50:00 +0200 Subject: [PATCH] test list results --- pandora/static/js/pandora.js | 67 +++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 4 deletions(-) diff --git a/pandora/static/js/pandora.js b/pandora/static/js/pandora.js index 8b99cbac9..cac37f028 100644 --- a/pandora/static/js/pandora.js +++ b/pandora/static/js/pandora.js @@ -429,7 +429,6 @@ $(function(){ }).appendTo(mainPanel) */ var content = new Ox.Container() - .css({'background-color': 'red'}) .appendTo(mainPanel); /* @@ -449,10 +448,70 @@ $(function(){ } }); */ - var results = new Ox.List({ - - }).appendTo(content); + var loadResult = function(find) { + var columns = [ { + align: "left", + id: "title", + operator: "+", + title: "Title", + width: 160 + }, + { + align: "left", + id: "director", + operator: "+", + title: "Director", + width: 160 + }, + { + align: "right", + id: "year", + operator: "-", + title: "Year", + width: 80 + } + ]; + if(find.key=='country') { + columns[columns.length] = { + align: "right", + id: "country", + operator: "+", + title: "Country", + width: 80 + }; + } + return new Ox.TextList({ + columns: columns, + request: function(options) { + app.request("find", $.extend(options, { + query: { + conditions: [ + { + key: find.key, + value: find.value, + operator: "=" + } + ], + operator: "&" + } + }), options.callback); + }, + sort: { + key: "year", + operator: "-" + } + }); + } + var results = loadResult({value:'', key:'title'}).appendTo(content); + Ox.Event.bind(false, 'submit_find', function(event, data) { + var r = loadResult({ + 'value': data.value, + 'key': data.option.substr(6).toLowerCase() + }); + results.replaceWith(r); + results = r; + }); app.launch(); });