Binding to remote data

2 posts, 0 answers
  1. sushant
    sushant avatar
    1 posts
    Member since:
    Mar 2015

    Posted 23 Mar 2015 Link to this post

    Hi i am new to kendo UI framework and trying my hands on tree view part.I am using Ajax for loading data but its not coming in Treeview format.i guess something wrong with the schema part the mapping is not correct ,i don't know how to map it exactly.Can anyone help me in this.right now i am able to load kendo tree using the local data.how can i convert this into remote data binding...???? here is my code: 

    public class EloquaTreeJSONBean {

    private String id;
    private String text;
    private String parent;
    private String type;
    }.....////////// follow with getters and setters  

    jsp code:

    var dataSource = new kendo.data.HierarchicalDataSource(
    {
    data : [
    {
    categoryName : "TransperfecttranslationPartner",imageUrl: "../resources/js/jstree/home.png",
    subCategories : [
    {
    subCategoryName : "Emails",imageUrl: "../resources/js/jstree/email_16.png",
    subCategories : [

    {
    subCategoryName : "Emails1.1",imageUrl: "../resources/js/jstree/email_16.png",
    },
    {
    subCategoryName : "Emails1.2",imageUrl: "../resources/js/jstree/email_16.png",
    },
    {
    subCategoryName : "Emails1.3",imageUrl: "../resources/js/jstree/email_16.png",
    }

    ]
    },
    {
    subCategoryName : "Landingpage",imageUrl: "../resources/js/jstree/eloquaLandingPageIcon.png",
    subCategories : [

    {
    subCategoryName : "landingpage1.1" ,imageUrl: "../resources/js/jstree/eloquaLandingPageIcon.png",
    },
    {
    subCategoryName : "landingpage1.2",imageUrl: "../resources/js/jstree/eloquaLandingPageIcon.png",
    },
    {
    subCategoryName : "landingpage1.3",imageUrl: "../resources/js/jstree/eloquaLandingPageIcon.png",
    }

    ]
    },
    {
    subCategoryName : "Dynamiccontent",imageUrl: "../resources/js/jstree/dynamicContentIcon.png",
    subCategories : [

    {
    subCategoryName : "Dynamiccontent.1",imageUrl: "../resources/js/jstree/dynamicContentIcon.png",
    },
    {
    subCategoryName : "Dynamiccontent.2",imageUrl: "../resources/js/jstree/dynamicContentIcon.png",
    },
    {
    subCategoryName : "Dynamiccontent.3",imageUrl: "../resources/js/jstree/dynamicContentIcon.png",
    }

    ]
    }, ]
    },

    ],
    schema : {
    model : {
    children : "subCategories"
    }
    }
    });

    $("#gltreegrid").kendoTreeView(
    {
    dataSource : dataSource,
    dataTextField : [ "categoryName",
    "subCategoryName" ],

    checkboxes: {
                   checkChildren: true
               },

               

    }); 
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 25 Mar 2015 Link to this post

    Hello Sushant,

    You can check the remote binding demo in the UI for JSP wrappers. Its server-side code shows how to serialize the JSON data. If you serialize it in the same format, you can point the dataSource transport.read configuration option to the service that produces the JSON tree (see here for a mocked example).

    Regards,
    Alex Gyoshev
    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
Back to Top