Lazy Loading for Accordion and TabView #1808

Closed
ilianiv opened this Issue Jan 13, 2017 · 2 comments

Projects

None yet

3 participants

@ilianiv
ilianiv commented Jan 13, 2017

I'm submitting a ... (check one with "x")

[ ] bug report => Search github for a similar issue or PR before submitting
[x] 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

Current behavior
When p-accordionTab is closed it's contents persist in DOM tree.

Expected behavior
Destroy p-accordionTab subtree when tab is not opened using *ngIf structural directive.

What is the motivation / use case for changing the behavior?
I use accordion component to display complex, grouped data and have a datatable, buttons and some summary in each accordion tab. When I explore accordion structure I see about 1000 DOM elements and 90% of them are hidden when no accordion tab is opened. A simple *ngIf here at div.ui-accordion-content-wrapper will have a huge performance impact.

  • Angular version: 2.4.1
  • PrimeNG version: 1.1.3
  • Browser: [all]
  • Language: [all]
@brian428

This could be an optional setting, but I don't think it should just replace the current behavior. There are plenty of reverse cases where you want the collapsed tabs to persist so the view's state is maintained.

@cagataycivici
Member

We need to make this configurable by lazy="true|false" that defaults to true for backward compatibility.

@cagataycivici cagataycivici self-assigned this Jan 17, 2017
@cagataycivici cagataycivici added this to the 2.0 milestone Jan 17, 2017
@cagataycivici cagataycivici changed the title from Use *ngIf in p-accordionTab for better performance to Lazy Loading for Accordion and TabView Jan 17, 2017
@cagataycivici cagataycivici added a commit that closed this issue Jan 17, 2017
@cagataycivici cagataycivici Fixed #1808 23a885e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment