This is a migrated thread and some comments may be shown as answers.

listview template where JSON key has a space in it

6 Answers 32 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 16 Dec 2013, 03:35 PM
Hi.  The key values in the JSON I am getting back have spaces in them.  this, I am not able to use the #: keyNameHere # notation in my template.  Additionally, the keys here are custom and will not be the same from customer to customer so I would like to be able to reference them with something like subscript values.  Is this possible?

6 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 16 Dec 2013, 04:04 PM
Hi Brian,

You can use the bracket notation to access JSON keys with spaces within the key property. Please check the following example:

http://jsbin.com/OHEDECOJ/1/edit

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Brian
Top achievements
Rank 1
answered on 16 Dec 2013, 04:11 PM
Thanks for your assistance, Kiril.  Yes, I tried that and it works if I do #= data['Cust Ident'] #, for example.  The problem is that the key will not be the same for every call.  I need to do something along the lines of #= data[0] # and this is not working for me.  Any suggestions?
0
Kiril Nikolov
Telerik team
answered on 16 Dec 2013, 04:37 PM
Hello Brian,

In the Kendo UI Templates you can fully execute JavaScript code. You can read more about it here:

http://docs.kendoui.com/getting-started/framework/templates/overview


What I am trying to say is that you can loop through the data object get the key and display its value in the template. Please check this example, showing some dummy data and let me know if it helps:

http://jsbin.com/OHEDECOJ/3/edit

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Brian
Top achievements
Rank 1
answered on 17 Dec 2013, 04:17 PM
Thanks for the information Kiril.  I got it working! :)
0
Kiril Nikolov
Telerik team
answered on 18 Dec 2013, 08:56 AM
Hello Brian,

I am glad that the information provided was helpful.

In case you have any further questions, please do not hesitate to contact us.

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Kiril Nikolov
Telerik team
answered on 18 Dec 2013, 08:56 AM
Hello Brian,

I am glad that the information provided was helpful.

In case you have any further questions, please do not hesitate to contact us.

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ListView (Mobile)
Asked by
Brian
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Brian
Top achievements
Rank 1
Share this question
or