2011-12-27 87 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')); 
}); 

我存儲在本地變量此值。