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

Hierarchical datasource created from two local data sets?

3 Answers 235 Views
Hierarchical Data Source
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 24 Jul 2012, 11:35 PM
Would it be possible to create a hierarchical datasource not from two endpoints, as the example shows below, but from two functions returning json.  Could the two transport sections below be replaced with data (as in data: getProductData()) functions which return data that the dataSource then "combines" the way it  does with remote endpoints?  If this is possible, how would the function returning the second level data (like products below) look?

var Categories = new kendo.data.HierarchicalDataSource({
    transport: {
        read: {
            url: "http://demos.kendoui.com/service/Categories"
        }
    },
    schema: {
        model: {
            hasChildren: "Products",
            id: "CategoryID",
            children: {
                transport: {
                    read: {
                        url: "http://demos.kendoui.com/service/Products"
                    }
                },
                schema: {
                    model: {
                        id: "ProductID",
                        hasChildren: false
                    }
                }
            }
        }
    }
});

3 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 26 Jul 2012, 07:52 AM
Hello Bill,

You can use functions for the read operations, as inherited from the DataSource (see its online docs). For an example of this functionality, consider this jsBin.

All the best,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Butter
Top achievements
Rank 1
answered on 19 Jul 2013, 09:16 AM
Hello bill
I want to know how the controller returns the value in Javascript but I dont know what to do.
 Please help me with this. Much appreciated
0
Butter
Top achievements
Rank 1
answered on 19 Jul 2013, 09:17 AM
I want to know how the controller returns the value in Javascript but I dont know what to do.
 Please help me with this. Much appreciated
Tags
Hierarchical Data Source
Asked by
Bill
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Butter
Top achievements
Rank 1
Share this question
or