Sencha Touch JSON 格式?
我是 Sencha Touch 的新手,现在致力于使用 Sencha touch 为移动平台创建一些复杂的银行解决方案。我经常使用 jQuery,但对 Sencha 框架还是个新手。我的问题是,sencha touch 是否有任何特定的 json 格式或者它会接受任何有效的 javascript 对象表示法?
例如,下面给出的是一个对象表示法
{"user": [{"name": "yyy","age": "10"},{"name": "xxx","age ": "20"},{"name": "zzz","age": "30"}]}
我能够将上述数据集绑定到 sencha DataView,但是我无法绑定 JSON格式如下
{"data": [["xxx","10"],["yyy","20"],["zzz","30"]]}
?
为什么会发生这种情况 sencha 是否正在寻找精确的键值对格式?或者 Sencha 中有其他选择吗?
任何帮助将不胜感激。
I am new to Sencha Touch and now engaged in creating some complex banking solutions using Sencha touch for mobile platforms. I have worked a lot with jQuery, but new to the Sencha framework. My question is, does sencha touch has any specific json format or it will accept any valid javascript object notation?
For example, given below is an object notation
{"user": [{"name": "yyy","age": "10"},{"name": "xxx","age": "20"},{"name": "zzz","age": "30"}]}
I am able to bind the above set of data to the sencha DataView, but i am not able to bind the JSON in the format below
{"data": [["xxx","10"],["yyy","20"],["zzz","30"]]}
Why does this happen? Is sencha looking for an exact key, value pair format? Or does it have any alternate option in Sencha?
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Ext.data.reader.Json
期望输入的格式与您的第一个示例相同。如果您只有第二种格式,您可以使用Ext.data.reader.Array
在第一次通过Ext.decode()
将 JSON 解析为实际的 JS 对象之后。Ext.data.reader.Json
expects the input to be formatted as your first example. If you have only second format avialble, you could for example useExt.data.reader.Array
after first passing it thoroughExt.decode()
to parse JSON into actual JS object.