forked from 0x2620/oxjs
make find work in listcalendar; fill first page in static text lists with few items; listen to width/height changes in listmap and listcalendar; fix a bug where maps would load without zoombar
This commit is contained in:
parent
5a04e4fb8e
commit
9fb30bf1af
5 changed files with 55 additions and 34 deletions
|
|
@ -192,7 +192,8 @@ Ox.List = function(options, self) {
|
|||
}
|
||||
|
||||
if (!self.isAsync) {
|
||||
self.$page = Ox.Element()
|
||||
self.$pages = [];
|
||||
self.$pages[0] = Ox.Element()
|
||||
.addClass('OxPage')
|
||||
.css({
|
||||
left: self.listMargin / 2 + 'px',
|
||||
|
|
@ -426,6 +427,7 @@ Ox.List = function(options, self) {
|
|||
var height = getHeight(),
|
||||
lastItemHeight = height % self.options.itemHeight || self.options.itemHeight,
|
||||
visibleItems = Math.ceil(height / self.options.itemHeight);
|
||||
Ox.print('FILL', self.listLength, visibleItems);
|
||||
if (self.listLength < visibleItems) {
|
||||
Ox.range(self.listLength, visibleItems).forEach(function(v) {
|
||||
var $item = Ox.ListItem({
|
||||
|
|
@ -685,7 +687,7 @@ Ox.List = function(options, self) {
|
|||
}
|
||||
|
||||
function loadItems() {
|
||||
self.$page.empty();
|
||||
self.$pages[0].empty();
|
||||
self.$items = [];
|
||||
var timeC = 0, timeA = 0;
|
||||
self.options.items.forEach(function(item, pos) {
|
||||
|
|
@ -700,9 +702,10 @@ Ox.List = function(options, self) {
|
|||
timeC += +new Date() - time0;
|
||||
isSelected(pos) && self.$items[pos].addClass('OxSelected');
|
||||
var time0 = +new Date();
|
||||
self.$items[pos].appendTo(self.$page);
|
||||
self.$items[pos].appendTo(self.$pages[0]);
|
||||
timeA += +new Date() - time0;
|
||||
});
|
||||
fillFirstPage();
|
||||
self.selected.length && scrollToPosition(self.selected[0]);
|
||||
Ox.print('CONSTRUCT:', timeC, 'APPEND:', timeA);
|
||||
// that.triggerEvent('init', {items: self.options.items.length});
|
||||
|
|
@ -1387,6 +1390,7 @@ Ox.List = function(options, self) {
|
|||
// fixme: this could be used to change the list
|
||||
// from sync to async or vice versa, which wouldn't work
|
||||
if (Ox.isArray(value)) {
|
||||
self.listLength = value.length;
|
||||
updateSelected();
|
||||
updateSort();
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue