Treegrid template column method called frequently

I added a template column method that maps an id to user friendly text.

I was surprised to find it gets called very frequently even when the treegrid has been displayed and nothing is happening. It seems to run on some sort of timer

Callstack for the breakpoint

callstack.jpg

Template method code:

    <e-column field="plaidAccountId" headerText="Account" [validationRules]="required" [edit]='accountEditOptions'
      [customAttributes]="customAttributes">
      <ng-template #template let-data>
        <span>
          {{this.accountIdMapper.getAccountName(data.plaidAccountId)}}
        </span>
        
      </ng-template></e-column>




5 Replies 1 reply marked as answer

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team September 30, 2021 04:01 PM UTC

  
Hi Zachary, 

Thanks for your interest in Syncfusion Components. 

Before start proceeding this, we need some more additional details about the issue. Share us the following details. 

  1. Replication steps of the issue you have faced.
  2. If possible replicate it in the sample with template column and revert us back.
  1. Video demo to replicate the issue from above sample.
  2. Does the method inside Template column call recursively or are you telling about any other methods?

The provided details will be helpful to provide you solution as early as possible. 

Regards, 
Farveen sulthana T 



ZA Zachary October 9, 2021 06:35 PM UTC

I have created a sample project with 3 rows.


I have a template column. I put a console.log everytime it is called.

When the treegrid is first loaded it gets called 24 times.

When I hover my mouse over the grid for a couple seconds it got called 2,400 times.


I was surprised to see it get called so frequently and wanted to check in with you guys to see if it is the intended behavio



gettext called frequently.jpg


Attachment: example_9537e427.zip


FS Farveen Sulthana Thameeztheen Basha Syncfusion Team October 11, 2021 04:20 PM UTC

Hi Zachary  

In Angular, while using a function inside the ng-template, then it will be executed for every change detection to check whether the element should be updated or not. This is the default behavior of Functions inside the Angular templates, which is not related to EJ2 TreeGrid component. However, you can overcome the reported behavior by using Pipes inside the template as suggested in the below reference link.  


Please get back to us if you need any further assistance. 

Regards,  
Farveen sulthana T 


Marked as answer

ZA Zachary October 13, 2021 03:19 PM UTC

Thanks for the help on this one Farveen.



FS Farveen Sulthana Thameeztheen Basha Syncfusion Team October 14, 2021 02:11 PM UTC

Hi Zachary,  

Thanks for your update. Please get back to us if you need any further assistance. We are happy to assist you. 

Regards, 
Farveen sulthana T 


Loader.
Up arrow icon