From 2aa828c30881e2db75dd771f9a35cea6c89f137d Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sun, 4 Sep 2011 16:43:52 +0000 Subject: [PATCH] add keys option to text list to allow for additional keys to be requested, beyond the keys of the visible columns --- source/Ox.UI/js/List/Ox.List.js | 1 + source/Ox.UI/js/List/Ox.TextList.js | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index 8d8d3e90..e13e9e7b 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -1658,6 +1658,7 @@ Ox.List = function(options, self) { value value, can be whatever that property is @*/ that.value = function(id, key, value) { + Ox.print('that.value', id, getPositionById(id)) var pos = getPositionById(id), $item = self.$items[pos], data = $item.options('data'), diff --git a/source/Ox.UI/js/List/Ox.TextList.js b/source/Ox.UI/js/List/Ox.TextList.js index 70ed49fb..eb0e16e9 100644 --- a/source/Ox.UI/js/List/Ox.TextList.js +++ b/source/Ox.UI/js/List/Ox.TextList.js @@ -27,6 +27,7 @@ Ox.TextList TextList Object draggable If true, items can be dragged id items function() {} {sort, range, keys, callback} or array + keys <[s]|[]> Additional keys (apart from keys of visible columns) max Maximum number of items that can be selected (-1 for all) min Minimum number of items that must be selected pageLength Number of items per page @@ -55,6 +56,7 @@ Ox.TextList = function(options, self) { draggable: false, id: '', items: null, // function() {} {sort, range, keys, callback} or array + keys: [], max: -1, min: 0, pageLength: 100, @@ -176,14 +178,13 @@ Ox.TextList = function(options, self) { construct: constructItem, draggable: self.options.draggable, id: self.options.id, - items: self.options.items, itemHeight: 16, items: self.options.items, itemWidth: getItemWidth(), format: self.format, // fixme: not needed, happens in TextList - keys: $.map(self.visibleColumns, function(v) { - return v.id; - }), + keys: Ox.merge(self.visibleColumns.map(function(column) { + return column.id; + }), self.options.keys), max: self.options.max, min: self.options.min, pageLength: self.options.pageLength, @@ -250,9 +251,9 @@ Ox.TextList = function(options, self) { that.$head.$content.empty(); constructHead(); that.$body.options({ - keys: $.map(self.visibleColumns, function(v, i) { - return v.id; - }) + keys: Ox.merge(self.visibleColumns.map(function(column) { + return column.id; + }), self.options.keys) }); that.$body.reloadPages(); } @@ -628,9 +629,9 @@ Ox.TextList = function(options, self) { width: itemWidth + 'px' }); that.$body.options({ - keys: $.map(self.visibleColumns, function(v, i) { - return v.id; - }) + keys: Ox.merge(self.visibleColumns.map(function(column) { + return colum.id; + }), self.options.keys) }); //that.$body.clearCache(); }