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. Image for the cookie policy date

Customizing group header using #groupSettingsCaptionTemplate on an ng-template does not work

I have a grid that is grouped by a column "category". This results in the following group headers: "category: 1", "category: 2", etc. 

How can I remove "category:" from the group header and only display "1", "2", etc ?

But it does not work in the latest version of syncfusion.

I am using the following versions of the npm packages
    "@angular/animations""^9.0.7",
    "@angular/common""^9.0.7",
    "@angular/compiler""^9.0.7",
    "@angular/core""^9.0.7",
    "@angular/forms""^9.0.7",
    "@angular/platform-browser""^9.0.7",
    "@angular/platform-browser-dynamic""^9.0.7",
    "@angular/router""^9.0.7",
    "@syncfusion/ej2""^17.4.55",
    "@syncfusion/ej2-angular-buttons""^17.4.51",
    "@syncfusion/ej2-angular-grids""^17.4.55",



Where is the documentation for "captionTemplate"? There is nothing about it here https://ej2.syncfusion.com/angular/documentation/grid/grouping/

8 Replies

GR Gokul Ramalingam Syncfusion Team March 26, 2020 03:54 AM UTC

Hi Skorri, 

Greetings from Syncfusion Support. 

Query: How can I remove "category:" from the group header and only display "1", "2", etc ? 
 
You can achieve your requirement using the groupSettings.captionTemplate which can be used to specify string template as follows. 

this.groupOptions = {  
          captionTemplate: ' <span class="groupItems" style="color:blue"> ${count} items</span>  
',  
           showGroupedColumn: falsecolumns: ['Country'  
};  


Query: Where is the documentation for "captionTemplate"?  
 
We have logged a documentation task for this and it will be available in any of our upcoming releases. 

Please get back to us if you need further assistance. 

Regards, 
Gokul R 



SJ Skorri Júlíusson March 26, 2020 08:55 AM UTC

My goal was to show only "1", "2", etc as the group headers. I have three categories: 1, 2 and 3.  I do not want to show "1 - 2 items", only "1".

Is it not possible to use <ng-template> for the group header?
If not, how do I get the value of the category to put in the string template?


MS Manivel Sellamuthu Syncfusion Team April 1, 2020 05:27 AM UTC

Hi Skorri, 

Thanks for your update. 

Yes, it is possible to achieve your requirement by using ng-template as like the below code example. But currently it is not working in Angular 9.we are validating this on our end. We will  get back to you once we completed validation. 

<ejs-grid #grid [dataSource]='data' [allowGrouping]='true' [groupSettings]='groupOptions' 
. . . 
    </e-columns>     
    <ng-template #groupSettingsCaptionTemplate let-data> 
      <div class="groupdiv"> 
      <span class="groupspan">{{data.key}} - {{data.count}} items  </span> 
       </div> 
     </ng-template> 
    </ejs-grid> 


Until then we suggest you to render the groupCaption template in the typescript way. Please find the below code example. 

       this.groupOptions = {   
          captionTemplate: ' <span class="groupItems"> ${key} -  ${count} items</span>',   
};   


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

Regards, 
Manivel 



MS Manivel Sellamuthu Syncfusion Team April 3, 2020 09:54 AM UTC

Hi Skorri, 

Thanks for your patience. 

We have confirmed that the behavior is an issue from our side and logged a bug for same as “Edit Template not working in Angular 9”. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our upcoming patch release Apr 15th 2020. 

You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.  
 

Regards, 
Manivel 



SJ Skorri Júlíusson April 3, 2020 10:00 AM UTC

Thank you, I will stay posted.


MS Manivel Sellamuthu Syncfusion Team April 6, 2020 05:22 AM UTC

Hi Skorri, 

Thanks for your update. 

We will update you once, we have included the fix. Until then we suggest you to use the workaround we have shared in our previous update. 

Please let us know if you need any further assistance. 

Regards, 
Manivel 



MS Manivel Sellamuthu Syncfusion Team April 15, 2020 06:54 AM UTC

Hi Skorri, 

While validating reported issue, we found that there is an issue in angular core level which will not trigger life cycle hook when template compilation takes place.so that reported issue takes place. once below angular team MR get merged reported issue will get resolved

Reference

  

Regards, 
Manivel 



MS Manivel Sellamuthu Syncfusion Team May 14, 2020 07:26 AM UTC

Hi All, 
  
We are glad to announce that our Essential Studio 2020 Volume 1 Service Pack1 release v18.1.52  is rolled out and is available for download under the following link. 
  
  
The reported issue “Edit Template not working in Angular 9'” is refreshed in that release. So kindly upgrade to our latest version (18.1.52) to resolve the reported issue.  
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
 
Screenshot:  
 
 
  
 
Please let us know, if you need further assistance. 
 
Regards, 
Manivel

Loader.
Live Chat Icon For mobile
Up arrow icon