1
0
Fork 0
forked from 0x2620/oxjs

slightly faster text list construction for cells that don't have tooltips; make calendar layout deterministic for events that have the same time span

This commit is contained in:
rlx 2011-10-11 06:32:20 +00:00
commit 527f75b009
4 changed files with 44 additions and 26 deletions

View file

@ -687,18 +687,24 @@ Ox.List = function(options, self) {
function loadItems() {
self.$page.empty();
self.$items = [];
var timeC = 0, timeA = 0;
self.options.items.forEach(function(item, pos) {
// fixme: duplicated
var time0 = +new Date();
self.$items[pos] = Ox.ListItem({
construct: self.options.construct,
data: item,
position: pos,
unique: self.options.unique
});
timeC += +new Date() - time0;
isSelected(pos) && self.$items[pos].addClass('OxSelected');
var time0 = +new Date();
self.$items[pos].appendTo(self.$page);
timeA += +new Date() - time0;
});
self.selected.length && scrollToPosition(self.selected[0]);
Ox.print('CONSTRUCT:', timeC, 'APPEND:', timeA);
// that.triggerEvent('init', {items: self.options.items.length});
// fixme: do sync lists need to trigger init?
// will this only be reached in sync lists?