We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Using *ngfor in e-panel component is not rendering when array is updated.

Thread ID:

Created:

Updated:

Platform:

Replies:

148253 Oct 11,2019 11:58 AM UTC Oct 16,2019 11:58 AM UTC Angular - EJ 2 5
loading
Tags: DashboardLayout
Sagar
Asked On October 14, 2019 10:07 AM UTC

When I add items in scorecards array, new e-panel is not being rendered.
<e-panel *ngFor="let scorecard of scorecards" [col]="scorecard.col" [row]="scorecard.row" [sizeX]="scorecard.sizeX" [sizeY]="scorecard.sizeY" [id] = "scorecard.id.toString()">
<ng-template #content >
<div>
<app-scorecard (closed)="closedTab(scorecard.id)" [id]="scorecard.id">app-scorecard>
div>
ng-template>
e-panel>
I verified that it is rendered issue by wrapping ejs-dashboardlayout in a div and using *ngIf to hard refresh the component, it worked that way. 
Is this a bug, or am I missing something? Thanks in advance.

Keerthana Rajendran [Syncfusion]
Replied On October 14, 2019 12:59 PM UTC

Hi Sagar, 
We have checked your reported query that dashboard layout panels is not updated dynamically. We suggest you to update the panels using service. For your reference we have prepared a sample. In that sample, we have dynamically updated the panel using service and again re-render the dashboard layout component. 
 Refer to the sample link below. 
Please let us know if you have any concerns. 
 
Regards, 
Keerthana.   


Sagar
Replied On October 15, 2019 07:33 AM UTC

Thank you for your reply and sample application. Please find my concerns below.

I see you are rendering the whole dashboard layout component whenever a new item is pushed to the scoreboard1. This is exactly what I am trying to avoid (performance reasons). I was able to achieve similar using *ngIf.

What my question is => Why the angular change detection does not kick off for dashboard layout component when a new item is pushed to scoreboard1? If I wrap my app-scorecard inside a div and use *ngFor on that div, then my component is rendered whenever I push an item on the array. The change detection kicks off.

Is there any alternative to this, so that I do not need to re-render the whole dashboard layout component each time I add a new item to the array?


Keerthana Rajendran [Syncfusion]
Replied On October 15, 2019 12:25 PM UTC

Hi Sagar,  
 
Good day to you. 
We have checked your reported query that dynamically update the panels without re-render the whole component. In dashboard layout, we have provided the addPanel() method. In that method, you have to set the panel properties (sizeX, sizeY, Row and Col, etc.).  
Whenever you want to update the scoreboard value, bind the changeDetection for that property(scorecard), in that call back function use the addPanel() method with newly updated value in a scorecard to render the new panel element without re-render the whole dashboard component. 
Refer the below sample link for dynamically update the panel content. 
Refer the below link for addPanel() method in dashboard layout. 
Please let us know, if you  require further assistance on this.  
Regards, 
Keerthana. 
 


Sagar
Replied On October 15, 2019 03:40 PM UTC

Thanks for the solution. It works.

The solution, however, looks like a work around rather than the optimal solution. 

Is the current behavior of dashboard layout component not rendering new component on pushing item to array intended? 

Is there any feature on pipeline to support dynamic component rendering using the method like addPanel()?

Anyway thank you very much for your assistance and a great library.


Keerthana Rajendran [Syncfusion]
Replied On October 16, 2019 11:58 AM UTC

Hi Sagar,  
  
Query 1 – Is the current behavior of dashboard layout component not rendering new component on pushing item to array intended?  
On further analysis about your requirement, change detection is not detected during a push (add a new item to an array) and pop operations. It detects only when the changes happened in existing array values. So, we suggest you to use the addPanel() method to dynamically add a panel. Refer to the sample in our previous update. 
  
Query 2 – Is there any feature on pipeline to support dynamic component rendering using the method like addPanel()? 
In the Dashboard layout, the content of the dashboard layout panels changed based on requirements (may be text, images or custom controls). So, it is difficult to handle this in our component side. We have not provided any method for dynamically generated content in our dashboard layout. We suggest you to manually update the content in the dashboard layout based on your requirement. 
  
Regards, 
Keerthana. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon