listview template where JSON key has a space in it

7 posts, 0 answers
  1. Brian
    Brian avatar
    23 posts
    Member since:
    Sep 2012

    Posted 16 Dec 2013 Link to this post

    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?
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 16 Dec 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Brian
    Brian avatar
    23 posts
    Member since:
    Sep 2012

    Posted 16 Dec 2013 Link to this post

    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?
  5. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 16 Dec 2013 Link to this post

    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!
  6. Brian
    Brian avatar
    23 posts
    Member since:
    Sep 2012

    Posted 17 Dec 2013 Link to this post

    Thanks for the information Kiril.  I got it working! :)
  7. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 18 Dec 2013 Link to this post

    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!
  8. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 18 Dec 2013 Link to this post

    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!
Back to Top
Kendo UI is VS 2017 Ready