adding menu using web-service / best practices

2 posts, 0 answers
  1. Piyush Bhatt
    Piyush Bhatt avatar
    166 posts
    Member since:
    Nov 2007

    Posted 21 Dec 2011 Link to this post

    I wanted to find out what is the best practice for showing menu in the application if we are using KendoUI. Whether it should be rendered from the server side using <ul> <li> tags or whether we should add dynamically using a web-service.

    I prepared a blog post with an example of how I did this but I am not too sure if this would be the recommended way going forward. - 

    Overall - I think we would need the functions in kendoUI objects' such a way that developer should not have to use selectors (like "li:last" or "li:first") etc and can work with the objects and methods only. 

    Again this is not direct question per say - but to know your thoughts on best practices and how you think people will be using various widgets in large applications.
  2. Kamen Bundev
    Kamen Bundev avatar
    1532 posts

    Posted 22 Dec 2011 Link to this post

    Hello Piyush,

    You can add one or several items directly (along with sub items, images, sprites, etc) by passing a JSON object as a Menu dataSource, like this:
        dataSource: [{
            text: "Item 1",
            url: ""                // Link URL if navigation is needed, optional.
            text: "Item 2",
            imageUrl: "", // Item image URL, optional.
            items: [{                                    // Sub item collection
                 text: "Sub Item 1"
                 text: "Sub Item 2"
            text: "Item 3",
            spriteCssClass: "imageClass3"                // Item image sprite CSS class, optional.

    The same JSON object can be used in append() too. Our documentation will get these updates soon.

    All the best,
    Kamen Bundev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top