fix a bug where in info list, the value of the sort key would not be requested when changing the sort order of the list (fixes #747)

This commit is contained in:
rlx 2012-04-22 11:50:57 +00:00
parent a56329064d
commit 374508a9f1
2 changed files with 14 additions and 9 deletions

View file

@ -65,7 +65,8 @@ Ox.IconList = function(options, self) {
self.itemWidth = self.options.size;
self.itemHeight = self.iconHeight + self.options.size * 0.5;
that.$element = Ox.List({
that.setElement(
Ox.List({
centered: self.options.centered,
// fixme: change all occurences of construct to render
construct: constructItem,
@ -89,7 +90,8 @@ Ox.IconList = function(options, self) {
select: function() {
self.options.selected = that.$element.options('selected');
}
});
})
);
updateKeys();
@ -141,7 +143,6 @@ Ox.IconList = function(options, self) {
} else if (key == 'sort') {
updateKeys();
that.$element.options(key, value);
//that.$element.sortList(key, operator);
}
};

View file

@ -21,12 +21,13 @@ Ox.InfoList = function(options, self) {
})
.options(options || {})
Ox.print('INFO LIST FIND', self.options.find);
//Ox.print('INFO LIST FIND', self.options.find);
self.iconSize = Math.round(self.options.size * 2/3);
self.itemHeight = self.options.size;
that.$element = Ox.List({
that.setElement(
Ox.List({
construct: constructItem,
draggable: self.options.draggable,
id: self.options.id,
@ -48,7 +49,8 @@ Ox.InfoList = function(options, self) {
select: function() {
self.options.selected = that.$element.options('selected');
}
});
})
);
updateKeys();
@ -139,9 +141,11 @@ Ox.InfoList = function(options, self) {
}
function updateKeys() {
self.options.keys = Ox.unique(Ox.merge(self.options.keys, [self.options.sort[0].key]));
that.$element.options({
keys: self.options.keys
keys: Ox.unique(Ox.merge(
self.options.sort[0].key,
self.options.keys
))
});
}
@ -149,9 +153,9 @@ Ox.InfoList = function(options, self) {
if (key == 'items') {
that.$element.options(key, value);
} else if (key == 'selected') {
Ox.Log('List', 'SELECTED', value)
that.$element.options(key, value);
} else if (key == 'sort') {
updateKeys();
that.$element.options(key, value);
} else if (key == 'width') {
var width = getItemWidth();