Subclassing kendo.data.Node and kendo.data.HierarchicalDataSource

2 posts, 0 answers
  1. Jack
    Jack avatar
    100 posts
    Member since:
    Jan 2007

    Posted 04 Feb 2015 Link to this post

    I would like to create a specific hierarchy of Manufacturers, Cars and Parts.

    To achieve this, I would like to subclass kendo.data.Node as follows:

    var Manufacturer = kendo.data.Node.extend({
    //...
    });
    var Car = kendo.data.Node.extend({
    //...
    });
    var Part = kendo.data.Node.extend({
    //...
    });

    I would then like to subclass kendo.data.HierachicalDataSource, to represent such a hierarchy.

    Question 1: How can I achieve that?

    Data comes from a RESTful JSON service located at:
    http://<ip address>/api/v1/manufacturers (GET, POST)
    http://<ip address>/api/v1/manufacturers/<mid> (GET, PUT, DELETE)
    http://<ip address>/api/v1/manufacturers/<mid>/cars (GET, POST)
    http://<ip address>/api/v1/manufacturers/<mid>/cars/<cid> (GET, PUT, DELETE)
    http://<ip address>/api/v1/manufacturers/<mid>/cars/<cid>/parts (GET, POST)
    http://<ip address>/api/v1/manufacturers/<mid>/cars/<cid>/parts/<pid> (GET, PUT, DELETE)

    Then I would like to instantiate my subclassed hierarchy to use this JSON service. 

    Question 2:  How can I achieve that?





  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 06 Feb 2015 Link to this post

    Hello Jacques,

    I'm afraid that this approach is not supported in a clean way. You can achieve it with the code shown in this Dojo snippet, but mixing the transport and models is unavoidable.

    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