in Ox.List, handle Ox.TreeList items update

This commit is contained in:
rolux 2012-06-17 19:13:18 +02:00
parent ad368fb819
commit fe8c97db24

View file

@ -70,20 +70,24 @@ Ox.List = function(options, self) {
.options(options || {})
.update({
items: function() {
if (Ox.isArray(self.options.items)) {
self.options.items = Ox.api(self.options.items, {
cache: true,
sort: self.options.sort,
sums: self.options.sums,
unique: self.options.unique
});
/*
self.listLength = self.options.items.length;
updateSelected();
updateSort();
*/
if (!self.isAsync) {
updateItems();
} else {
if (Ox.isArray(self.options.items)) {
self.options.items = Ox.api(self.options.items, {
cache: true,
sort: self.options.sort,
sums: self.options.sums,
unique: self.options.unique
});
/*
self.listLength = self.options.items.length;
updateSelected();
updateSort();
*/
}
updateQuery();
}
updateQuery();
},
selected: function() {
var previousSelected = self.selected;
@ -239,20 +243,8 @@ Ox.List = function(options, self) {
];
}
if (!self.isAsync) {
self.$pages = [];
self.$pages[0] = Ox.Element()
.addClass('OxPage')
.css({
left: self.listMargin / 2 + 'px',
top: self.listMargin / 2 + 'px'
})
.appendTo(that.$content);
self.listLength = self.options.items.length;
loadItems();
} else {
updateQuery();
}
!self.isAsync ? updateItems() : updateQuery();
that.bindEvent(self.keyboardEvents);
//Ox.UI.$window.resize(that.size); // fixme: this is not the widget's job
@ -1297,6 +1289,21 @@ Ox.List = function(options, self) {
unloadPage(page + 1)
}
function updateItems() {
clear();
that.$content.empty();
self.$pages = [];
self.$pages[0] = Ox.Element()
.addClass('OxPage')
.css({
left: self.listMargin / 2 + 'px',
top: self.listMargin / 2 + 'px'
})
.appendTo(that.$content);
self.listLength = self.options.items.length;
loadItems();
}
function updatePages(pos, scroll) {
// only used if orientation is both
clear();