简体   繁体   English

将嵌套的json绑定到商店,然后将该商店在sencha touch 2中列出

[英]Bind nested json to a store and that store to list in sencha touch 2

I am a newbie when comes to Sencha touch 2. I am stuck at a point where i am binding a jsonp data with store. 我是Sencha touch 2的新手。我被困在与商店绑定jsonp数据的地方。 My jsonp data created using newtons json library is as follows:- 我使用newtons json库创建的jsonp数据如下:-

getjobinfo({"success":true,"method":"GetJobInfo","errormsg":"","csjob":{"jobguid":"1ac1d6bf-80bd-4555-aeba-77e5bdb7b265","jobcode":"ABCDEFGH","jobdescription":"This is the job description. It's a great job. You'll make a lot of money. Hardly any work required.","jobquestions":[{"jobquestionguid":"1ac1d6bf-80bd-4555-aeba-77e5bdb7b266","jobquestiontext":"Describe what you would do if you made a lot of money."},{"jobquestionguid":"1ac1d6bf-80bd-4555-aeba-77e5bdb7b267","jobquestiontext":"Please describe your unique approach to doing nothing and the biggest challenge you've faced doing nothing in other jobs."}]}});

The number of questions are dynamic depending on jobcode 问题数量是动态的,具体取决于工作代码

i want to get jobcode also and at a different place i want to bind the questions to the list. 我也想获得工作代码,并且希望在其他地方将问题绑定到列表。

but if i try to bind questions i cant access jobcode and viceversa. 但是,如果我尝试绑定问题,我将无法访问工作代码,反之亦然。

I want to use only one store. 我只想使用一家商店。 Models can be used more than once. 模型可以使用多次。

But ho to associate the models that i dont know. 但是,如何关联我不知道的模型。

Please help. 请帮忙。

It seems that you want to save your JSON data to an Ext.data.TreeStore and display its data through an Ext.NestedList . 似乎您想将JSON数据保存到Ext.data.TreeStore并通过Ext.NestedList显示其数据。 Here's a good example to start: an example of Sencha Touch nested list and tree store 这是一个很好的例子: Sencha Touch嵌套列表和树存储的例子

Note: just look at the public folder. 注意:只是看的公用文件夹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM