How to extract an id from the datasource and set as a div id?

1 posts, 0 answers
  1. Igor
    Igor avatar
    3 posts
    Member since:
    Sep 2012

    Posted 13 Sep 2012 Link to this post

    Hello

    I got a datasource returning following:

    [
      {"id":"1","text":"host1","spriteCssClass":"server"}
      {"id":"2","text":"host2","spriteCssClass":"server"}
    ]

    and following code

    $("#treeview-hosts").kendoTreeView({
            dragAndDrop: true,
            dataSource: {
                transport: {
                    read: {
                        url: "/main/getEnvHosts",
                        type: 'POST',
                        data: '{"env":"'+env+'"}',
                    }
                },
                schema: {
                    model: {
                        id: "id"
                    }, 
                },
            }
         
    });


    I need to extract the ID from DataSource and have it assigned to the element, but not entirely sure how to to that. Available documentation is rather confusing...
Back to Top