Sencha touch Sencha nestedList getActiveItem()
我正在使用此型号:Sencha touch Sencha nestedList getActiveItem(),sencha-touch,extjs,nested-lists,sencha-touch-2,Sencha Touch,Extjs,Nested Lists,Sencha Touch 2,我正在使用此型号: Ext.regModel('ListItem', { fields: [ {name: 'id', type: 'string'}, {name: 'text', type: 'string'}, {name: 'number', type: 'string'} ] }); var nestedList = new Ext.NestedList({ fullscreen: true,
Ext.regModel('ListItem', {
fields: [
{name: 'id', type: 'string'},
{name: 'text', type: 'string'},
{name: 'number', type: 'string'}
]
});
var nestedList = new Ext.NestedList({
fullscreen: true,
title: ivrData.text,
store: NestedListDemo.music_store,
getDetailCard: function(item, parent) {
alert(item.attributes.record.data.number);
}
});
嵌套列表是:
Ext.regModel('ListItem', {
fields: [
{name: 'id', type: 'string'},
{name: 'text', type: 'string'},
{name: 'number', type: 'string'}
]
});
var nestedList = new Ext.NestedList({
fullscreen: true,
title: ivrData.text,
store: NestedListDemo.music_store,
getDetailCard: function(item, parent) {
alert(item.attributes.record.data.number);
}
});
我试图通过单击按钮获取活动项的.number属性
handler : function(btn, evt) {
var temp = nestedList.getActiveItem();
alert(temp.number);
alert(temp.attributes.record.data.number);
}
我可以通过alert(item.attributes.record.data.number)在leafnode上获取.number属性代码>但我在尝试获取temp的.number属性时遇到以下错误:
警报(温度编号)代码>打印-->未定义
警报(临时属性、记录、数据、编号)代码>给出错误-->“类型错误:表达式“临时属性”[undefined]的结果不是对象”“使用下面的代码获取了nestedlist的activenode的所有属性:
nestedList.on('itemtap', function(subList, subIdx, item, e, detailCard) {
alert(subList.getRecord(item).get('id'));
alert(subList.getRecord(item).get('name'));
alert(subList.getRecord(item).get('number'));
});
我将这些值存储在局部变量中。顺便说一句,警报(temp)给出[object]