|
|
@ -62,7 +62,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, { |
|
|
|
}) : o.items; |
|
|
|
}) : o.items; |
|
|
|
this._populate(); |
|
|
|
this._populate(); |
|
|
|
this.ticking = false; |
|
|
|
this.ticking = false; |
|
|
|
this.element.scroll(function() { |
|
|
|
this.element.scroll(function () { |
|
|
|
o.scrollTop = self.element.scrollTop(); |
|
|
|
o.scrollTop = self.element.scrollTop(); |
|
|
|
if (!self.ticking) { |
|
|
|
if (!self.ticking) { |
|
|
|
requestAnimationFrame(function () { |
|
|
|
requestAnimationFrame(function () { |
|
|
@ -123,7 +123,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, { |
|
|
|
} |
|
|
|
} |
|
|
|
this.bottomBlank.setHeight(this.tree.sumTo(this.renderedIndex) - this.tree.sumTo(Math.min(end, this.renderedIndex))); |
|
|
|
this.bottomBlank.setHeight(this.tree.sumTo(this.renderedIndex) - this.tree.sumTo(Math.min(end, this.renderedIndex))); |
|
|
|
this.container.populate(items.map(function (item, i) { |
|
|
|
this.container.populate(items.map(function (item, i) { |
|
|
|
return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i) |
|
|
|
return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i); |
|
|
|
})); |
|
|
|
})); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
for (var i = (start < 0 ? 0 : start); i <= end; i++) { |
|
|
|
for (var i = (start < 0 ? 0 : start); i <= end; i++) { |
|
|
@ -134,7 +134,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, { |
|
|
|
} |
|
|
|
} |
|
|
|
this.container.element.height(o.rowHeight * o.items.length - topHeight); |
|
|
|
this.container.element.height(o.rowHeight * o.items.length - topHeight); |
|
|
|
this.container.populate(items.map(function (item, i) { |
|
|
|
this.container.populate(items.map(function (item, i) { |
|
|
|
return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i) |
|
|
|
return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i); |
|
|
|
})); |
|
|
|
})); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -162,6 +162,13 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, { |
|
|
|
this.bottomBlank.setHeight(0); |
|
|
|
this.bottomBlank.setHeight(0); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 暂时只支持固定行高的场景
|
|
|
|
|
|
|
|
scrollTo: function (scrollTop) { |
|
|
|
|
|
|
|
this.options.scrollTop = scrollTop; |
|
|
|
|
|
|
|
this._calculateBlocksToRender(); |
|
|
|
|
|
|
|
this.element.scrollTop(scrollTop); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
restore: function () { |
|
|
|
restore: function () { |
|
|
|
this.options.scrollTop = 0; |
|
|
|
this.options.scrollTop = 0; |
|
|
|
this._restore(); |
|
|
|
this._restore(); |
|
|
|