add keys option to text list to allow for additional keys to be requested, beyond the keys of the visible columns

This commit is contained in:
rlx 2011-09-04 16:43:52 +00:00
parent 6adacf484f
commit 2aa828c308
2 changed files with 12 additions and 10 deletions

View file

@ -1658,6 +1658,7 @@ Ox.List = function(options, self) {
value <s> value, can be whatever that property is value <s> value, can be whatever that property is
@*/ @*/
that.value = function(id, key, value) { that.value = function(id, key, value) {
Ox.print('that.value', id, getPositionById(id))
var pos = getPositionById(id), var pos = getPositionById(id),
$item = self.$items[pos], $item = self.$items[pos],
data = $item.options('data'), data = $item.options('data'),

View file

@ -27,6 +27,7 @@ Ox.TextList <f:Ox.Element> TextList Object
draggable <b|false> If true, items can be dragged draggable <b|false> If true, items can be dragged
id <s|''> id <s|''>
items <f|null> function() {} {sort, range, keys, callback} or array items <f|null> function() {} {sort, range, keys, callback} or array
keys <[s]|[]> Additional keys (apart from keys of visible columns)
max <n|-1> Maximum number of items that can be selected (-1 for all) max <n|-1> Maximum number of items that can be selected (-1 for all)
min <n|0> Minimum number of items that must be selected min <n|0> Minimum number of items that must be selected
pageLength <n|100> Number of items per page pageLength <n|100> Number of items per page
@ -55,6 +56,7 @@ Ox.TextList = function(options, self) {
draggable: false, draggable: false,
id: '', id: '',
items: null, // function() {} {sort, range, keys, callback} or array items: null, // function() {} {sort, range, keys, callback} or array
keys: [],
max: -1, max: -1,
min: 0, min: 0,
pageLength: 100, pageLength: 100,
@ -176,14 +178,13 @@ Ox.TextList = function(options, self) {
construct: constructItem, construct: constructItem,
draggable: self.options.draggable, draggable: self.options.draggable,
id: self.options.id, id: self.options.id,
items: self.options.items,
itemHeight: 16, itemHeight: 16,
items: self.options.items, items: self.options.items,
itemWidth: getItemWidth(), itemWidth: getItemWidth(),
format: self.format, // fixme: not needed, happens in TextList format: self.format, // fixme: not needed, happens in TextList
keys: $.map(self.visibleColumns, function(v) { keys: Ox.merge(self.visibleColumns.map(function(column) {
return v.id; return column.id;
}), }), self.options.keys),
max: self.options.max, max: self.options.max,
min: self.options.min, min: self.options.min,
pageLength: self.options.pageLength, pageLength: self.options.pageLength,
@ -250,9 +251,9 @@ Ox.TextList = function(options, self) {
that.$head.$content.empty(); that.$head.$content.empty();
constructHead(); constructHead();
that.$body.options({ that.$body.options({
keys: $.map(self.visibleColumns, function(v, i) { keys: Ox.merge(self.visibleColumns.map(function(column) {
return v.id; return column.id;
}) }), self.options.keys)
}); });
that.$body.reloadPages(); that.$body.reloadPages();
} }
@ -628,9 +629,9 @@ Ox.TextList = function(options, self) {
width: itemWidth + 'px' width: itemWidth + 'px'
}); });
that.$body.options({ that.$body.options({
keys: $.map(self.visibleColumns, function(v, i) { keys: Ox.merge(self.visibleColumns.map(function(column) {
return v.id; return colum.id;
}) }), self.options.keys)
}); });
//that.$body.clearCache(); //that.$body.clearCache();
} }