Is there a way to override title attribute for group template caption?

Hello,

After providing a group template caption in my grid  the title attribute of the caption is the template string that was provided like in the example image below.


Is there a way to prevent this behavior or to override it and provide my own string?


Thank you,

Daniel.


3 Replies 1 reply marked as answer

PS Pavithra Subramaniyam Syncfusion Team June 3, 2022 01:58 PM UTC

Hi Daniel Szuster,


The “Caption Template” feature is used to show the customized text in the caption cell and the same will be set to the title attribute without any change. This is the default behavior of the EJ2 Grid component. However, if you want to show some other value in the tooltip, you can change this inside the “dataBound” event of Grid as below.


dataBound() {

  let caption: NodeListOf<Element> = grid.element.querySelectorAll('.e-groupcaption');

  caption.forEach((e: Element) => {

    e.setAttribute('title', e.getAttribute('title').replace(/<(.|\n)*?>/g''));

  });

}


API: https://ej2.syncfusion.com/angular/documentation/api/grid/#databound


Please get back to us if you need further assistance on this.


Regards,

Pavithra S


Marked as answer

DS Daniel Szuster replied to Pavithra Subramaniyam June 6, 2022 04:15 AM UTC

Thank you very much, this is exactly what was looking for.



SS Swetha Srikumar Syncfusion Team June 6, 2022 10:33 AM UTC

Hi Daniel,

Most welcome, we are glad to know that the solution works.

Regards,

Swetha


Loader.
Up arrow icon