From 189c19b09706465ce925f11845e518758881bd25 Mon Sep 17 00:00:00 2001 From: sanj Date: Mon, 10 Jan 2011 10:56:14 +0530 Subject: [PATCH] list --- itf/app/models.py | 4 ++-- itf/static/js/itf/itf.js | 42 +++++++++++++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/itf/app/models.py b/itf/app/models.py index 1538312..8e9acbb 100644 --- a/itf/app/models.py +++ b/itf/app/models.py @@ -87,11 +87,11 @@ class ItfModel(models.Model): search = options['search'] if search != '': qset = kls.fts(qset, search) - + ''' sort = options['sort'] if sort != []: qset = qset.order_by(sort[0]) #FIXME: Do Sort! - + ''' r0 = options['range'][0] r1 = options['range'][1] results = qset[r0:r1] diff --git a/itf/static/js/itf/itf.js b/itf/static/js/itf/itf.js index 9c39cc7..939bf6e 100644 --- a/itf/static/js/itf/itf.js +++ b/itf/static/js/itf/itf.js @@ -700,6 +700,7 @@ Ox.ItfBox = function(options, self) { .html(title/*.toUpperCase()*/) .appendTo($titlebar); + var $search = new Ox.Input({ 'placeholder': 'Search', }) @@ -786,11 +787,15 @@ Ox.ItfBox = function(options, self) { }); } - var $list = new Ox.List({ + var $listContainer = new Ox.Element() + .appendTo(that) + .css({position: 'relative', height: '100%'}); + + var $list = new Ox.TextList({ 'width': 256, - 'itemHeight': 16, - 'itemWidth': 250, - 'orientation': 'horizontal', +// 'itemHeight': 16, +// 'itemWidth': 250, +// 'orientation': 'horizontal', 'request': function(data, callback) { return app.api.find(getQueryParams(data), callback) }, @@ -799,10 +804,33 @@ Ox.ItfBox = function(options, self) { var $a = $('').attr("href", "/" + options.module.toLowerCase() + "/" + data.id).text(data.title); var $item = $('
').addClass('OxTarget').append($a); return $item; - } + }, + 'max': 1, + 'columns': [ + { + align: 'left', + id: 'title', + operator: '-', + unique: false, + visible: true, + width: 230 + }, + { + id: 'id', + visible: false, + unique: true + } + ], + 'sort': [{ + key: 'title', + operator: '-' + }] }) - .css({'overflow-x': 'hidden'}) - .appendTo(that); +// .css({position: 'relative', height: '100%'}) + .appendTo($listContainer) + .bindEvent("select", function(e, data) { + alert(JSON.stringify(data)); + }); // $buttons = new Ox.