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

TreeList breaks when using TreeListModel inherited from a Model

3 Answers 51 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Michelle
Top achievements
Rank 1
Michelle asked on 20 Aug 2015, 06:35 PM

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

3 Answers, 1 is accepted

Sort by
0
Michelle
Top achievements
Rank 1
answered on 24 Aug 2015, 06:56 PM

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

Thanks,

Michelle

0
T. Tsonev
Telerik team
answered on 25 Aug 2015, 12:17 PM
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!
 
0
T. Tsonev
Telerik team
answered on 28 Aug 2015, 01:13 PM
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!
 
Tags
TreeList
Asked by
Michelle
Top achievements
Rank 1
Answers by
Michelle
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or