Hierarchical datasource created from two local data sets?

4 posts, 0 answers
  1. Bill
    Bill avatar
    13 posts
    Member since:
    Jul 2012

    Posted 24 Jul 2012 Link to this post

    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
                        }
                    }
                }
            }
        }
    });
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 26 Jul 2012 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Butter
    Butter avatar
    9 posts
    Member since:
    Jul 2013

    Posted 19 Jul 2013 Link to this post

    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
  5. Butter
    Butter avatar
    9 posts
    Member since:
    Jul 2013

    Posted 19 Jul 2013 Link to this post

    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
Back to Top
Kendo UI is VS 2017 Ready