2011-12-27 96 views
0

我使用这个模型:煎茶nestedList getActiveItem()

Ext.regModel('ListItem', { 
    fields: [ 
     {name: 'id', type: 'string'}, 
     {name: 'text', type: 'string'}, 
     {name: 'number', type: 'string'} 
    ] 
}); 

nestedList是:

var nestedList = new Ext.NestedList({ 
      fullscreen: true, 
      title: ivrData.text, 
      store: NestedListDemo.music_store, 
      getDetailCard: function(item, parent) { 
       alert(item.attributes.record.data.number); 
      } 
     }); 

我试图让财产activeItem。数上按钮点击。

handler : function(btn, evt) { 
     var temp = nestedList.getActiveItem(); 
     alert(temp.number); 
     alert(temp.attributes.record.data.number); 
} 

我能够通过alert(item.attributes.record.data.number);得到叶节点上的。数财产,但我得到这些错误,而试图得到。数属性温度:

alert(temp.number);版画 - >未定义

alert(temp.attributes.record.data.number);给出错误 - > “类型错误:表达的结果 'temp.attributes'[未定义]不是对象

+0

顺便提一下,alert(temp)给出了[object Object] – 2011-12-27 11:10:13

回答

0

得到了下面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')); 
}); 

我存储在本地变量此值。