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

TreeView causes "Maximum call stack size exceeded" error when binding to BreezeJS entities

4 Answers 685 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 27 Aug 2014, 06:18 PM
I'm using kendoTreeView, with Angular and BreezeJS.  When I bind directly to the breeze entities, this results in a stack overflow scenario.  I assume this is because the breeze entities have circular references with them.

For example, each breeze entity has an "entityAspect" property to track entity state, which contains a reference back to the entity itself.  I.e. myEntity.entityAspect.Entity -> myEntity.

In addition, some entities may contain circular references within the model.  For example, Customer->Order->Customer.  

Is there a way to configure the kendoTreeView to ignore cycles, or to ignore certain paths within the object graph?

4 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 29 Aug 2014, 05:23 AM
Hello Randy,

Can you please provide a sample project that shows this? The TreeView does not traverse all properties, so unless the circular dependency is what describes the children, it shouldn't go into a stack overflow. If possible, remove the BreezeJS dependency and show the problem with plain JavaScript objects -- that will clarify whether the problem is in Breeze or in Kendo UI.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Randy
Top achievements
Rank 1
answered on 29 Aug 2014, 01:04 PM
Here is some sample code.  Note that the otherData is the part that contains the circular reference.  I don't need to display the otherData.  How can I tell the treeview to ignore this property?

01.var dataManager = {};
02.var otherDataNotToDisplay = [{
03.    text: "something else 1",
04.    rootManager: dataManager // NOTE it refers to the root data manager
05.}];
06. 
07.dataManager.data = [{
08.        text: "Test1", Id: 1,
09.        hasKids: false,
10.        myKids: {},
11.        otherData: otherDataNotToDisplay // NOTE this leads to the other object which causes a circular reference
12.    },
13.    {
14.        text: "Test2", Id: 2,
15.        hasKids: false,
16.        myKids: {}
17.    }];
18. 
19.var dataSource = new kendo.data.HierarchicalDataSource({
20.    data: dataManager.data,
21.    schema: {
22.        model: {
23.            hasChildren: 'hasKids',
24.            children: "myKids",
25.                 
26.        }
27.    }
28.});
29. 
30.vm.treeData = dataSource;

0
Alex Gyoshev
Telerik team
answered on 29 Aug 2014, 02:33 PM
Hello Randy,

The problem is more general than the TreeView -- see this Dojo snippet on a minimal reproduction with kendo.observable. I am afraid that circular references are not supported, nor have we claimed compatibility with BreezeJS. However, you can use the breeze-kendo library if you wish.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Randy
Top achievements
Rank 1
answered on 29 Aug 2014, 02:52 PM
Alex, thanks for the response.  I agree, the problem is more general... I also get the error when binding to the kendogrid.  The dojo snippet demonstrates the problem exactly.   I have seen the breeze-kendo library, and it does work, however I was hoping to be able to bind to entities already fetched locally, rather than using the entity manager to query them every time (as the breeze-kendo data source does).
Tags
TreeView
Asked by
Randy
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Randy
Top achievements
Rank 1
Share this question
or