how to encode ampersand in row caption

2 posts, 1 answers
  1. Anne Marie
    Anne Marie avatar
    1 posts
    Member since:
    Feb 2013

    Posted 28 Jun 2017 Link to this post


    I have found a problem when having text with ampersand in the data used for a pivot grid when expanding the row or column with that ampersand in the caption.  A JavaScript exception is caused in the browser (Chrome & IE).  The exception is "Uncaught TypeError: Cannot read property 'value' of undefined at init._buildRow" in kendo.all.js:73938.  The undefined object is dataItem.

    I have encoded the ampersand using & within the string at the datasource and whilst that is displayed correctly I believe the & within the encoded & is still causing the exception.  I have tried using the rowHeaderTemplate and the row encoded property but neither seem to stop the error from occurring.  Is there another way I should be encoding this text so that it doesn't break the JavaScript code?

    My original project is Kendo UI for MVC but I have created a dojo using the JavaScript version to re-create the problem.

  2. Answer
    Alex Hajigeorgieva
    Alex Hajigeorgieva avatar
    441 posts

    Posted 30 Jun 2017 Link to this post

    Hello Anne Marie,

    Thank you very much for the provided Dojo to illustrate your case.

    The observed behaviour is expected because the member captions are used for the creation of the paths which are going to be expanded. Despite the fact that this is expected, I believe that it is not desired and would like to investigate if there is anything we can do about it. Therefore, I have logged this as an issue and you may follow its progress at:

    If possible, as a workaround, you should keep the member captions 'ampersand-free' and use the rowHeaderTemplate to replace them with an ampersand so they look as desired:

    rowHeaderTemplate: function(e){
     if(e.member.caption.indexOf(" and ") > 0){
      return e.member.caption.replace("and", "&");
     } else {
      return e.member.caption;

    For your convenience, here is the modified Dojo:

    As a token of appreciation, I have also updated your Telerik points. Thank you very much for identifying this issue.

    Alex Hajigeorgieva
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top