item constructor

This commit is contained in:
j 2011-06-20 16:37:37 +02:00
parent 3dae403037
commit 8906cecd3e

View file

@ -9,7 +9,8 @@ Ox.IconList <f:Ox.Element> IconList Object
draggable <b|true> can be dragged
id <s|''> element id
item <f|null> called with data, sort, size,
extends data with information needed for Ox.IconItem
extends data with information needed for constructor
itemConstructor <f|Ox.IconItem> contructor used to create item
items <f|null> items array or callback function
keys <a|[]> available item keys
max <n|-1> maximum selected selected items
@ -30,6 +31,7 @@ Ox.IconList = function(options, self) {
draggable: true,
id: '',
item: null,
itemConstructor: Ox.IconItem,
items: null,
keys: [],
max: -1,
@ -80,7 +82,7 @@ Ox.IconList = function(options, self) {
self.options.item(data, self.options.sort, self.options.size) :
{height: 8, width: 5},
ratio = data.width / data.height;
return Ox.IconItem($.extend(data, {
return self.options.itemConstructor($.extend(data, {
height: Math.round(self.options.size / (ratio <= 1 ? 1 : ratio)),
size: self.options.size,
width: Math.round(self.options.size * (ratio >= 1 ? 1 : ratio))