Skip to content

Commit

Permalink
Add LazyLoadOnInit flag for Data View (primefaces#12526)
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Mangl committed Aug 21, 2023
1 parent 5f1fb48 commit bc0634f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/app/components/dataview/dataview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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());
}

Expand Down
10 changes: 9 additions & 1 deletion src/app/showcase/doc/apidoc/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -25685,4 +25693,4 @@
}
}
}
}
}

0 comments on commit bc0634f

Please sign in to comment.