Kendo Charts with Invalid JS Identifier property names

Posted by Matt Bryson on 17-Jun-2014 14:08:53
Find me on:

Ran in to this little issue with Kendo charts.

The field names that we want to map to are unknown. Some of the imported data, whilst valid JS property name via bracket notation would fail in Kendo.

{    
"21-30":10,
}

 

To get round this, change how you set the field name from:

 

field:"21-30";

to:

field:"['21-30']";

or in our case:

 field:"['"+ name +"']";

Topics: Kendo UI

About the author

Matt Bryson is an experienced systems engineer with over 15 years Development and Systems Operations experience.

Free eBook Download

The 5 big eDetailing issues you should be aware of. Click below to download the eBook.

Download now

Subscribe to Email Updates