TreeList breaks when using TreeListModel inherited from a Model

4 posts, 0 answers
  1. Michelle
    Michelle avatar
    33 posts
    Member since:
    Feb 2015

    Posted 20 Aug 2015 Link to this post

    I am trying to supply a TreeList widget with a list of TreeListModel objects that are based on  Model objects.  The way I am creating the TreeListModels is that I first create an empty kendo Model definition with no fields defined and then I create a TreeListModel definition with the empty base Model passed into the TreeList Model's define method as the first parameter, such that the TreeListModel inherits from the base Model.  I realize that this is not documented as being part of the public API, but for my application, we require such a setup because we proxy generate our TreeListModels, which extends (typescript) from a commonly shared Model definition.  I have created a simple example to demonstrate how the TreeList shows "loading" forever as soon as I try to do this model wrapping.  Please comment out the indicated parameter to see the breakage.

    http://dojo.telerik.com/IdAhI 

     Any suggestions on workarounds/bug fixes, would be greatly appreciated. 

    Thanks!
    Michelle

  2. Michelle
    Michelle avatar
    33 posts
    Member since:
    Feb 2015

    Posted 24 Aug 2015 Link to this post

    Any thoughts before I open a support ticket for this issue? 

    Thanks,

    Michelle

  3. Kendo UI is VS 2017 Ready
  4. T. Tsonev
    Admin
    T. Tsonev avatar
    2771 posts

    Posted 25 Aug 2015 Link to this post

    Hello,

    Please accept my apologies for the delayed response.

    The configuration used in the sample is not supported.
    It actually results in a runtime error, hence the loading indicator.

    Currently there's no official way to define a base model with shared fields.
    I'll check this in detail and get back to you with a recommendation if we have one.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. T. Tsonev
    Admin
    T. Tsonev avatar
    2771 posts

    Posted 28 Aug 2015 Link to this post

    Hi,

    I can confirm that there's no built-in method for sharing base model fields. At least not an official one.

    The data source schema does have a private modelBase setting that works like this:
          var ModelBase = kendo.data.TreeListModel.define({
            id: "id",
            fields:{
              id: { type: "number" },
              parentId: { type: "number" }
            }
          });

          var dataSource = new kendo.data.TreeListDataSource({
            schema: {
              modelBase: ModelBase,
              fields:{
                name: { type: "string" }
              }
            }
          });


    Not sure if this will fit in your scenario as you don't get to instantiate your own model. See this snippet for a demo.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready