0
votes

Using BreezeJS entities, and trying to display them using a KendoTreeView from KendoUI. The tree view throws this error, presumably because of the circular references. There are multiple cycles in breeze entities, the most obvious is entity.entityAspect.entity, and also the model may contain circular refs as well (e.g. Customer->Orders->Customer). How can I configure the KendoTreeView to only process specific navigation properties, and ignore the ones that lead to circular refs?

I realize I can for loop through the entities and build up a secondary array for display purposes. However, I am hoping to bind directly to the entities if possible, rather than trying to manually keep the tree in sync with the entity array.

FWIW I am using angular binding, etc (not sure if that makes a difference in this case).

1

1 Answers

0
votes

This is a standard circular reference javascript serialization issue. It is not a Breeze specific issue.

Circular references are a natural feature of entity models. Consider a Customer.Orders property that returns the customer's orders and each order has a Order.Customer navigation property to get back to its parent customer. This is to be expected and will result in an error like the one you experienced when trying to serialize such a graph unless you manage the serialization explicitly.

See this link: http://www.breezejs.com/documentation/knockout-circular-references

or this post: Maximum call stack exccedwith using KendoUI grid and breeze.js