LazyLoading fails for TabView
I'm submitting a ... (check one with "x")
[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
Plunkr Case (Bug Reports) Plunkr (with [email protected])
Current behavior
TabView does not render templates in lazy loading (with pTemplate="content").
Minimal reproduction of the problem with instructions
You can see on plunkr that I copy-pasted the code from TabView's docs. Here the code cycles through TabView's contentChildren: https://github.com/primefaces/primeng/blob/1e66a7c2acb0a77ec102ab9d44caa8f5fbff27fd/src/app/components/tabview/tabview.ts#L113
Though, they still are PrimeTemplates. https://github.com/primefaces/primeng/blob/1e66a7c2acb0a77ec102ab9d44caa8f5fbff27fd/src/app/components/tabview/tabview.ts#L96
And since there is no <p-templateLoader> anymore...
I haven't checked on other components, but this might be a shared issue.
- PrimeNG version: 5.2.0.rc-1
EDIT: FileUpload has the same issue. https://github.com/primefaces/primeng/blob/1e66a7c2acb0a77ec102ab9d44caa8f5fbff27fd/src/app/components/fileupload/fileupload.ts#L126
This is also occurring in version 5.0.2
@cagataycivici I think this might be a breaking behaviour for a lot of developers... Any thought about this? Can you fix it in RC2?
For us it is a breaking behaviour. We have many pages with lazy loading tabs. With PrimeNG version 5.2.0.rc-1 and 5.2.0.rc-2 we see any content.
For us it is a breaking behaviour too!
https://github.com/primefaces/primeng/blob/1e66a7c2acb0a77ec102ab9d44caa8f5fbff27fd/src/app/components/tabview/tabview.ts#L72
after change to
<span *ngIf="contentTemplate && (cache ? loaded : selected)">
lazy mode works fine for me!
just replace ng-template to span or div block
Laziness doesn't work when [selected]="false is present. This might be confusing while generating tabs with *ngFor.
Removing [selected] attribute while generating p-tabPanel using *ngFor worked perfect. To select a default tab set [activeIndex] with index of tab to select on p-tabView. With these changes only active tab gets initialized when tabView is initialized
Is this change accommodated now?
can confirm that [selected] attribute breaks laziness, not having selected attribute gives this error:
TabPanel.html:2 ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'ui-helper-hidden: true'. Current value: 'ui-helper-hidden: false'.
at viewDebugError (core.js:16657)
at expressionChangedAfterItHasBeenCheckedError (core.js:16645)
at checkBindingNoChanges (core.js:16747)
at checkNoChangesNodeInline (core.js:19618)
at checkNoChangesNode (core.js:19607)
at debugCheckNoChangesNode (core.js:20211)
at debugCheckDirectivesFn (core.js:20139)
at Object.eval [as updateDirectives] (TabPanel.html:2)
...
Having the same problem. Having *ngFor and [selected] breaks laziness.
Removing [selected] attribute while generating p-tabPanel using *ngFor worked perfect. To select a default tab set [activeIndex] with index of tab to select on p-tabView. With these changes only active tab gets initialized when tabView is initialized
Doesn't work for me.