Escaping special characters in Kendo PivotGrid for JQuery V1

1 Answer 125 Views
PivotGrid
JRC.T.6
Top achievements
Rank 1
JRC.T.6 asked on 16 Dec 2022, 10:12 AM

Hi there,

Legacy PivotGrid does not support special characters in the column field headers (and possibly elsewhere), e.g. '&'. Is there a recommended escaping strategy - for example if I have a 'you & me' string, how do I transform it? and should I do it before datasource-ing the Pivot or in a header template?

(Looks like PivotGrid V2 does support this out of the box)

Thanks,
Georgi

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 21 Dec 2022, 07:59 AM

Hello Alessio,

You can use the columnHeaderTemplate that renders the content of the column header cell and add the needed text there.

https://docs.telerik.com/kendo-ui/api/javascript/ui/pivotgrid/configuration/columnheadertemplate

<script id="columnTemplate" type="text/x-kendo-template">
    # if (member.name === "[Date].[Calendar].[Year].&[2005]") { #
        <h2>#: member.caption # </h2>
    # } else { #
        text & % $ #: member.caption # 
    # } #
</script>

Here is a Dojo example where the above is demonstrated.

I hope this helps.

Regards,


Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

JRC.T.6
Top achievements
Rank 1
commented on 22 Dec 2022, 10:21 AM

Hi Neli,

Thanks for your reply.

In my case the problem is when member.caption has special symbols in it, e.g. when member.caption = 'you & me', then you get

 

If you can please help me to solve this?

 

Regards,

i Vesela Koleda,

Georgi

 

Peter Milchev
Telerik team
commented on 27 Dec 2022, 09:09 AM

Hi Georgi, Весела Коледа и на теб!

We have tried to change the caption to the value you suggested but that did not cause any JS errors:

Could you please check if updating to the latest version would resolve the issue?

Also, it would be great if you are able to modify the shared dojo or another dojo example to replicate the issue and send it back to us.

Another option would be to make a capture with our new Fiddler Jam browser extension and share the produced link in a private support ticket. A correct capture would allow us to mock the page rendering locally and investigate further.

JRC.T.6
Top achievements
Rank 1
commented on 03 Jan 2023, 12:08 PM

Hi Petar and Neli,

Щастлива и успешна нова година!

One easy way to replicate the problem in the context of your dojo would be to rename all occurrences of 'Beverages' in your products.js file to 'Beverages & more', then click on the caption to expand and you'll get...

 

This works in Pivot grid v2. What would be the recommended strategy to escape the dynamically sourced data in your experience?

Best,
Georgi

 

Neli
Telerik team
commented on 06 Jan 2023, 09:21 AM

Hi Alessio,

Thank you for providing additional infromation on how to replicates the issue. There is such bug logged in our official GitHub repository and below you will find a link to the item:

https://github.com/telerik/kendo-ui-core/issues/3367

In the item there is also a suggested workaround.

Based on your report I have increased the priority of the item.

Regards,

Neli

Tags
PivotGrid
Asked by
JRC.T.6
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or