如何在sencha触摸获取价值形式记录 [英] How to get value form record in sencha touch
问题描述
这里我打印记录。
我做了什么。
onWordTap: function(view,index,target,record,event){
var wordName = record.get('name');
console.log(Word --->>>>+ wordName);
console.log(record);
},
但我收到控制台如下: - > Word --->>>>> undefined
我也尝试过:
var wordName = record.data.get('name');
但获得
未捕获TypeError:Object#没有方法'get'我的JSON看起来像这样: JSON
我以前的问题也与此类型的问题有关,请看。 上一个问题
解决方案看起来你在数据对象中有一个数据属性。所以这意味着sencha识别记录,因为它只有一个字段实际上称为数据。所以,如果没有错,输出的是什么?
console.log(record.get('data'));
另外,请添加与包含
记录
。I am trying to get value from nested json, but unable to get value. I have following data structure. Here I am printing record.
What i did.
onWordTap: function(view, index, target, record, event) { var wordName=record.get('name'); console.log("Word--->>>>"+wordName); console.log(record); },
but i get in console like this:->
Word--->>>>undefined
I have tried this also:
var wordName=record.data.get('name');
but getting
Uncaught TypeError: Object # has no method 'get'
my JSON looks like this: JSON
My previous question is also related to this type question, please watch . Previous Problem
解决方案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
.这篇关于如何在sencha触摸获取价值形式记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!