Maximum call stack exccedwith using KendoUI grid and breeze.js

烈酒焚心 提交于 2019-12-24 02:38:12

问题


I'm facing a problem to integrate breeze.js and kenoui grid . I have an observable array in my view model , I fill this array calling ajax operation . when I wire the array to the grid I get an exception "Maximum call stack exceeded" . I read a post that the grid has a problem with the entityacpect inside breeze.js entity. Is there any hot fix for this problem , or any other suggestion.

Thanks in advance ...


回答1:


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.

You can even get a circular reference problem with a Breeze entity that has no circular navigation paths. The difficulty stems from the fact that every Breeze entity has an inherent circularity by way of its entityAspect property:

This kind of circular reference is NOT an issue for Breeze if you go thru the Breeze EntityManager.executeQuery or EntityManager.saveChanges methods because Breeze automatically handles the serialization process for you, however if you bypass these methods, which you have presumably done, then you have to manage the serialization yourself.

So you have two approaches.

1) Use EntityManager.executeQuery to perform your ajax operation. Almost any endpoint can be reached via this method.

2) Read the following article ( it's about knockout but the issues are the same) and manage your serialization explicitly: http://www.breezejs.com/documentation/knockout-circular-references



来源:https://stackoverflow.com/questions/19860110/maximum-call-stack-exccedwith-using-kendoui-grid-and-breeze-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!