improve InfoList

This commit is contained in:
rlx 2011-10-16 12:32:02 +00:00
commit 95f3d536ec
7 changed files with 105 additions and 46 deletions

View file

@ -39,8 +39,13 @@ Ox.InfoList = function(options, self) {
sort: self.options.sort,
type: 'info',
unique: self.options.unique
})
.addClass('OxInfoList');
}, Ox.clone(self))
.addClass('OxInfoList')
.bindEvent({
select: function() {
self.options.selected = that.$element.options('selected');
}
});
updateKeys();
@ -64,10 +69,10 @@ Ox.InfoList = function(options, self) {
var $icon = Ox.Element()
.css({
float: 'left',
width: '128px',
height: '192px',
margin: '4px',
background: 'rgba(255, 255, 255, 0.1)'
width: '132px',
height: '194px',
margin: '2px',
//background: 'blue'
})
.append(
Ox.IconItem(Ox.extend(data.icon, {
@ -76,10 +81,11 @@ Ox.InfoList = function(options, self) {
iconWidth: 128, //self.iconWidth,
imageHeight: data.height,
imageWidth: data.width,
isInfoList: true,
itemHeight: self.itemHeight,
itemWidth: 128,
}))
.addClass('OxIcon')
.addClass('OxInfoIcon')
.css({
position: 'absolute'
})
@ -89,7 +95,8 @@ Ox.InfoList = function(options, self) {
float: 'left',
width: getItemWidth() - 152 + 'px',
height: '192px',
margin: '4px'
margin: '4px',
//background: 'green'
}),
$infobox = Ox.Element()
.css({
@ -103,7 +110,8 @@ Ox.InfoList = function(options, self) {
.css({
width: getItemWidth() - 8 + 'px',
height: 192 + 'px',
margin: '4px'
margin: '4px',
//background: 'red'
})
.append($icon)
.append($info);
@ -153,10 +161,6 @@ Ox.InfoList = function(options, self) {
$parent.parent().css({width: width - 152});
$parent.parent().parent().css({width: width - 8});
Ox.print('@@@', this.className, id)
Ox.print('@@@', this.className, id)
Ox.print('@@@', this.className, id)
Ox.print('@@@', this.className, id)
Ox.print('@@@', this.className, id)
Ox.UI.elements[id].options({width: width - 152});
});
}
@ -167,6 +171,47 @@ Ox.InfoList = function(options, self) {
return that;
};
that.paste = function(data) {
that.$element.paste(data);
return that;
};
that.reloadList = function() {
that.$element.reloadList();
return that;
};
that.scrollToSelection = function() {
that.$element.scrollToSelection();
return that;
};
that.size = function() {
that.$element.size();
};
that.sortList = function(key, operator) {
self.options.sort = [{
key: key,
operator: operator
}];
updateKeys();
that.$element.sortList(key, operator);
return that;
};
that.value = function(id, key, value) {
// fixme: make this accept id, {k: v, ...}
if (arguments.length == 1) {
return that.$element.value(id);
} else if (arguments.length == 2) {
return that.$element.value(id, key);
} else {
that.$element.value(id, key, value);
return that;
}
};
return that;
};