Ext.tree.Panel 내부의 이벤트 처리기에서 내 treepanel에 액세스하려면 어떻게해야합니까?트리의 이벤트 처리기에서 루트 노드에 어떻게 액세스합니까?
다음 itemClick 코드가 작동하지 않습니다. 나는 모두 '위로' 및 '내려'가는 시도했다. 내가 도구 모음에 버튼이있는 경우
Ext.create('Ext.tree.Panel', {
title: 'Example Tree',
width: 200,
height: 450,
store: store,
listeners: {
itemclick: function(dv, record, item, index, e) {
var me = this;
var panel = me.up('treepanel');
var rn = panel.getRootNode(); //panel undefined :(
}
}
}
그러나 그것을 잘 작동합니다 :
dockedItems: [{
xtype: 'toolbar',
dock: 'bottom',
items: [{
text: 'Search',
handler: function() {
var me = this;
var panel = me.up('treepanel');
var rn = panel.getRootNode(); // :)
}
}]
}]
이 두 예는이 fiddle에 예시되어있다.
me.getRootNode()를 사용하면 현재 구성 요소를 참조 할 수 있다고 생각합니다. – Sreek521