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

Binding to remote data

1 Answer 144 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
sushant
Top achievements
Rank 1
sushant asked on 23 Mar 2015, 10:25 AM
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
           },

           

}); 

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 25 Mar 2015, 08:26 AM

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!
 
Tags
TreeView
Asked by
sushant
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or