primeng icon indicating copy to clipboard operation
primeng copied to clipboard

LazyLoading fails for TabView

Open AndreaBarbasso opened this issue 8 years ago • 11 comments

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

AndreaBarbasso avatar Jan 17 '18 12:01 AndreaBarbasso

This is also occurring in version 5.0.2

rhornrrs avatar Jan 19 '18 16:01 rhornrrs

@cagataycivici I think this might be a breaking behaviour for a lot of developers... Any thought about this? Can you fix it in RC2?

AndreaBarbasso avatar Jan 23 '18 08:01 AndreaBarbasso

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.

mnhock avatar Jan 23 '18 08:01 mnhock

For us it is a breaking behaviour too!

TishchenkoAlex avatar Jan 24 '18 19:01 TishchenkoAlex

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

TishchenkoAlex avatar Jan 24 '18 20:01 TishchenkoAlex

Laziness doesn't work when [selected]="false is present. This might be confusing while generating tabs with *ngFor.

berzhy avatar Feb 13 '18 16:02 berzhy

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

ManishaSatpute1 avatar Apr 11 '18 12:04 ManishaSatpute1

Is this change accommodated now?

manjeet13 avatar Oct 29 '18 08:10 manjeet13

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)
    ...

gatapia avatar Nov 01 '18 05:11 gatapia

Having the same problem. Having *ngFor and [selected] breaks laziness.

samsal avatar Aug 08 '19 23:08 samsal

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.

kidkai25 avatar Sep 07 '22 22:09 kidkai25