in Ox.List, handle Ox.TreeList items update
This commit is contained in:
parent
ad368fb819
commit
fe8c97db24
1 changed files with 34 additions and 27 deletions
|
@ -70,20 +70,24 @@ Ox.List = function(options, self) {
|
||||||
.options(options || {})
|
.options(options || {})
|
||||||
.update({
|
.update({
|
||||||
items: function() {
|
items: function() {
|
||||||
if (Ox.isArray(self.options.items)) {
|
if (!self.isAsync) {
|
||||||
self.options.items = Ox.api(self.options.items, {
|
updateItems();
|
||||||
cache: true,
|
} else {
|
||||||
sort: self.options.sort,
|
if (Ox.isArray(self.options.items)) {
|
||||||
sums: self.options.sums,
|
self.options.items = Ox.api(self.options.items, {
|
||||||
unique: self.options.unique
|
cache: true,
|
||||||
});
|
sort: self.options.sort,
|
||||||
/*
|
sums: self.options.sums,
|
||||||
self.listLength = self.options.items.length;
|
unique: self.options.unique
|
||||||
updateSelected();
|
});
|
||||||
updateSort();
|
/*
|
||||||
*/
|
self.listLength = self.options.items.length;
|
||||||
|
updateSelected();
|
||||||
|
updateSort();
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
updateQuery();
|
||||||
}
|
}
|
||||||
updateQuery();
|
|
||||||
},
|
},
|
||||||
selected: function() {
|
selected: function() {
|
||||||
var previousSelected = self.selected;
|
var previousSelected = self.selected;
|
||||||
|
@ -239,20 +243,8 @@ Ox.List = function(options, self) {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self.isAsync) {
|
!self.isAsync ? updateItems() : updateQuery();
|
||||||
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();
|
|
||||||
}
|
|
||||||
that.bindEvent(self.keyboardEvents);
|
that.bindEvent(self.keyboardEvents);
|
||||||
//Ox.UI.$window.resize(that.size); // fixme: this is not the widget's job
|
//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)
|
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) {
|
function updatePages(pos, scroll) {
|
||||||
// only used if orientation is both
|
// only used if orientation is both
|
||||||
clear();
|
clear();
|
||||||
|
|
Loading…
Reference in a new issue