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