How to get value form record in sencha touch

后端 未结 3 1659
我在风中等你
我在风中等你 2020-12-11 08:38

I am trying to get value from nested json, but unable to get value. I have following data structure. Here I am printing record.

相关标签:
3条回答
  • 2020-12-11 08:48

    your JSON contains array of data , so you need to access it with index. you can do it like this.

    var wordName = record.data[0].get('name');
    
    0 讨论(0)
  • 2020-12-11 08:50

    I am assuming this is a DataView or a List, and that onWordTap is a listener for for itemtap.

    If that is the case, to get data from records, you just need record.get('name'). You can also use record.get('definitions')[0].definition (note that you've spelled it defintion in your code - beware).

    0 讨论(0)
  • 2020-12-11 09:02

    It looks like you have a data property inside the data object. So it means sencha recognize the record as it has only one field actually called data. So, if im not wrong, what's the output of:

    console.log(record.get('data'));
    

    Also, please add the model associated to the store containing record.

    0 讨论(0)
提交回复
热议问题