diff --git a/src/app/components/dataview/dataview.ts b/src/app/components/dataview/dataview.ts index b57a16d8fe2..b4194fd46db 100755 --- a/src/app/components/dataview/dataview.ts +++ b/src/app/components/dataview/dataview.ts @@ -196,6 +196,11 @@ export class DataView implements OnInit, AfterContentInit, OnDestroy, BlockableU * @group Props */ @Input() lazy: boolean | undefined; + /** + * Whether to call lazy loading on initialization. + * @group Props + */ + @Input() lazyLoadOnInit: boolean = true; /** * Text to display when there is no data. Defaults to global value in i18n translation configuration. * @group Props @@ -349,7 +354,7 @@ export class DataView implements OnInit, AfterContentInit, OnDestroy, BlockableU constructor(public el: ElementRef, public cd: ChangeDetectorRef, public filterService: FilterService, public config: PrimeNGConfig) {} ngOnInit() { - if (this.lazy) { + if (this.lazy && this.lazyLoadOnInit) { this.onLazyLoad.emit(this.createLazyLoadMetadata()); } diff --git a/src/app/showcase/doc/apidoc/index.json b/src/app/showcase/doc/apidoc/index.json index e557cdc8089..65cd3c506d4 100644 --- a/src/app/showcase/doc/apidoc/index.json +++ b/src/app/showcase/doc/apidoc/index.json @@ -7506,6 +7506,14 @@ "default": "false", "description": "Defines if data is loaded and interacted with in lazy manner." }, + { + "name": "lazyLoadOnInit", + "optional": false, + "readonly": false, + "type": "boolean", + "default": "true", + "description": "Whether to call lazy loading on initialization." + }, { "name": "emptyMessage", "optional": false, @@ -25685,4 +25693,4 @@ } } } -} \ No newline at end of file +}