在编辑页面中,我将域对象作为JSON对象传递,以便在客户端使用jQuery进行操作。
将domainClassObject渲染为JSON
当我在客户端看到响应时(例如在firebug中),没有“version”属性。 仅缺少“版本”,所有其他值都可用。 这是什么原因以及如何在使用“as JSON”时将“version”值作为服务器响应的一部分来做什么?
谢谢。 杰伊钱德兰。
In a edit page, I am passing the domain object as JSON object to be manipulated at client side using jQuery.
render domainClassObject as JSON
When I see the response in client side (in firebug for e.g.), there is no "version" property. Only "version" is missing, all other values are available. What is the reason for this and what should I do to get the "version" value also as part of response from server when using "as JSON"
Thank You. Jay Chandran.
最满意答案
根据Grails转换器参考 :
grails.converters.json.domain.include.version(Boolean) - 如果JSON转换器默认包含域中的版本,则设置为true(默认值:false)
在Config.groovy中将此设置为true。
Per the Grails Converters reference:
grails.converters.json.domain.include.version (Boolean) - Set to true if JSON Converter should default include version from domain (default: false)
Set this to true in your Config.groovy.
更多推荐
发布评论