|
|
|
@ -26,7 +26,6 @@ export class VirtualGroupList extends Widget {
|
|
|
|
|
|
|
|
|
|
init() { |
|
|
|
|
this.renderedIndex = -1; |
|
|
|
|
this._initSummaryHeight(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static xtype = "bi.virtual_group_list"; |
|
|
|
@ -45,7 +44,7 @@ export class VirtualGroupList extends Widget {
|
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: VirtualGroup.xtype, |
|
|
|
|
height: this.summaryHeight, |
|
|
|
|
height: rowHeight * items.length, |
|
|
|
|
ref: (ref) => { |
|
|
|
|
this.container = ref; |
|
|
|
|
}, |
|
|
|
@ -84,10 +83,8 @@ export class VirtualGroupList extends Widget {
|
|
|
|
|
o.scrollTop = this.element.scrollTop(); |
|
|
|
|
if (!this.ticking) { |
|
|
|
|
requestAnimationFrame(() => { |
|
|
|
|
const start = new Date().getTime(); |
|
|
|
|
this._calculateBlocksToRender(); |
|
|
|
|
this.ticking = false; |
|
|
|
|
console.log(new Date().getTime() - start); |
|
|
|
|
}); |
|
|
|
|
this.ticking = true; |
|
|
|
|
} |
|
|
|
@ -203,21 +200,16 @@ export class VirtualGroupList extends Widget {
|
|
|
|
|
_restore() { |
|
|
|
|
const o = this.options; |
|
|
|
|
this.renderedIndex = -1; |
|
|
|
|
this._initSummaryHeight(); |
|
|
|
|
if (isFunction(o.rowHeight)) { |
|
|
|
|
this.summaryHeight = sum(o.items, o.rowHeight); |
|
|
|
|
} else { |
|
|
|
|
this.summaryHeight = this._isAutoHeight() ? 0 : o.rowHeight * o.items.length; |
|
|
|
|
} |
|
|
|
|
// 依赖于cache的占位元素也要初始化
|
|
|
|
|
this.topBlank.setHeight(0); |
|
|
|
|
this.bottomBlank.setHeight(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_initSummaryHeight() { |
|
|
|
|
const { rowHeight, items } = this.options; |
|
|
|
|
if (isFunction(rowHeight)) { |
|
|
|
|
this.summaryHeight = sum(items, rowHeight); |
|
|
|
|
} else { |
|
|
|
|
this.summaryHeight = this._isAutoHeight() ? 0 : rowHeight * items.length; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 暂时只支持固定行高的场景
|
|
|
|
|
scrollTo(scrollTop) { |
|
|
|
|
this.options.scrollTop = scrollTop; |
|
|
|
|