Ox.ColumnList: add public 'sort' method

This commit is contained in:
rolux 2012-12-18 22:48:57 +01:00
parent cdf49b0bbe
commit 86019a83fb

View file

@ -55,6 +55,7 @@ Ox.ColumnList = function(options, self) {
items: i == 0 ? self.options.items : [], items: i == 0 ? self.options.items : [],
itemWidth: self.columnWidths[i], itemWidth: self.columnWidths[i],
keys: self.options.columns[i].keys, keys: self.options.columns[i].keys,
// FIXME: undefined max will overwrite CustomList default
max: self.options.columns[i].max, max: self.options.columns[i].max,
resize: self.options.resize, resize: self.options.resize,
scrollbarVisible: true, scrollbarVisible: true,
@ -184,6 +185,13 @@ Ox.ColumnList = function(options, self) {
}); });
} }
that.sort = function(id, sort) {
var index = Ox.isNumber(id) ? id
: Ox.getIndexById(self.options.columns, id);
self.$lists[index].options({sort: sort});
self.options.columns[index].sort = sort;
};
return that; return that;
}; };