使用KendoUI网格和breeze.js的最大调用堆栈 [英] Maximum call stack exccedwith using KendoUI grid and breeze.js

查看:72
本文介绍了使用KendoUI网格和breeze.js的最大调用堆栈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在集成breeze.js和kenoui grid时遇到了一个问题.我的视图模型中有一个可观察的数组,我填充此数组以调用ajax操作.当我将数组连接到网格时,出现异常"Maximum call stack超出了".我读了一篇文章,其中说网格在breeze.js实体内的entityacpect有问题. 是否有针对此问题的任何热修复程序,或任何其他建议.

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.

预先感谢...

推荐答案

这是标准的循环引用javascript序列化问题.这不是Breeze的特定问题.

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

循环引用是实体模型的自然特征.考虑一个返回客户订单的Customer.Orders属性,每个订单都有一个Order.Customer导航属性以返回其父客户.这是预料之中的,并且会导致错误,就像您尝试序列化此类图时遇到的错误一样,除非您显式管理序列化.

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.

对于没有循环导航路径的Breeze实体,您甚至可以获得循环参考问题.困难源于这样一个事实,即每个Breeze实体都通过其objectAspect属性具有固有的圆度:

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:

如果您使用Breeze的 EntityManager.executeQuery EntityManager.saveChanges 方法,这种循环引用对于Breeze来说不是问题,因为Breeze会自动处理以下内容的序列化过程但是,如果您绕过了您大概已经完成的这些方法,则必须自己管理序列化.

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)使用 EntityManager.executeQuery 来执行ajax操作.通过这种方法几乎可以到达任何端点.

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

2)阅读以下文章(关于淘汰赛,但问题相同),并明确管理序列化: http://www.breezejs.com/documentation/knockout-circular-references

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

这篇关于使用KendoUI网格和breeze.js的最大调用堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆