原文:
http://extjs.com/forum/showthread.php?t=46336
通过为Ext.data.JsonReader的字段加上convert来处理条件映射的问题。
示例如下:
{"licences":[{"Id":2,"LicenseKey":"123456","Point":null,"Owner":{"Id":1,"Name":"Witbit"}, "Mac":null,"Active":false},
{"Id":3,"LicenseKey":"789013","Point":null,"Owner":null, "Mac":null,"Active":false}]}
this.DS = new Ext.data.Store(
{
reader: new Ext.data.JsonReader(
{
root: "licences",
fields: [ "Id", "LicenseKey", {name:"Owner_Name", mapping:"Owner.Name"}, "Point", "Mac", "Active" ]
})
});
修改Owerne.Name的Mapping方式为下面:
{name:"Owner_Name", mapping:"Owner", convert: function(v) {return v ? v.Name : null;}}
分享到:
相关推荐
Convenience library for handling JSON objects in Java. Goals: Usability Minimise verbosity Play well with Nashorn JavaScript engine from Java 8 In essence Json is just a thin wrapper around a Map ...
sap Handling unit introduction
使用 HTML (JavaScript) 处理 JSON 数据,无需 Web 服务器我制作了一个使用本地 HTML (JavaScript) 处理 JSON 数据的示例,而无需设置 Web 服务器。Base_01:基本使用本地 HTML ... 基于 JSON 数据link.json.
gta Handling Editor 4 or hz
Windows Exception Handling
JSON is an established standard format used to exchange data. This book shows how JSON plays different roles in full web development ...providing solutions to your applications and handling complexity.
symfony-json-request-transformer, 用于解码JSON编码请求内容的Symfony 2事件侦听器 symfony-json-request-transformer用于解码JSON编码请求内容的Symfony事件侦听器。 请阅读关于这里知识库的博客文章,位于 /...
Handling3DInteractionandUIControlsinAugmentedReality ARKit 3D AR swift demo
api-ms-win-core-errorhandling-l1-1-0.dll
Abe M. Vehicle Handling Dynamics: Theory and Application[M]
NULL 博文链接:https://haoyp.iteye.com/blog/1211547
Andrei Alexandrescu 在CppCon上的演讲。关于Expected和ScopeGuard的设计思想,实现与应用。
Occlusion Handling in Generic Object Detection A Review.pdf
Occlusion Handling in Generic Object Detection A Review.zip
Handling IRPs.doc
Handling IRPs.pdf
ECOOP 2005 workshop Exception Handling
Handling2.2.exe
:rocket:安装 :gear:安装服务器依赖项npm install运行服务器 :chequered_flag:npm start资料夹结构 :file_folder:服务器端├── controllers # Contains logic for handling the json request and response├─...
Constraint Handling Methods for Management Systems of Pavement Maintenance and Rehabilitation,He Zhi-qiang,Sun Xiao-ling,The rate of good level highway in the network is the most important ...