define(["require", "exports", "../base/constant", "../renderer/group-lazy-load-renderer", "../base/enum"], function (require, exports, events, group_lazy_load_renderer_1, enum_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var LazyLoadGroup = (function () {
function LazyLoadGroup(parent, serviceLocator) {
this.parent = parent;
this.serviceLocator = serviceLocator;
this.addEventListener();
}
LazyLoadGroup.prototype.getModuleName = function () {
return 'lazyLoadGroup';
};
LazyLoadGroup.prototype.addEventListener = function () {
if (this.parent.isDestroyed) {
return;
}
this.parent.on(events.initialLoad, this.instantiateRenderer, this);
this.parent.on(events.destroy, this.destroy, this);
};
LazyLoadGroup.prototype.removeEventListener = function () {
if (this.parent.isDestroyed) {
return;
}
this.parent.off(events.initialLoad, this.instantiateRenderer);
this.parent.off(events.destroy, this.destroy);
};
LazyLoadGroup.prototype.instantiateRenderer = function () {
if (this.parent.height === 'auto') {
this.parent.height = this.parent.pageSettings.pageSize * this.parent.getRowHeight();
}
var renderer = this.serviceLocator.getService('rendererFactory');
Eif (this.parent.groupSettings.enableLazyLoading) {
renderer.addRenderer(enum_1.RenderType.Content, new group_lazy_load_renderer_1.GroupLazyLoadRenderer(this.parent, this.serviceLocator));
}
if (this.parent.enableVirtualization) {
this.parent.lazyLoadRender = new group_lazy_load_renderer_1.GroupLazyLoadRenderer(this.parent, this.serviceLocator);
}
};
LazyLoadGroup.prototype.destroy = function () {
this.removeEventListener();
};
return LazyLoadGroup;
}());
exports.LazyLoadGroup = LazyLoadGroup;
});
|