ExtJS 4のtreepanel
にドラッグアンドドロップ機能を実装しようとしています。基本的に、treepanelからいくつかのノードをテキストにドラッグしたいボックス。 ExtJS 4でdrag-n-dropが実装されている方法とかなり混乱していますが、私はいくつかのコードを書くことも試みました。それが正しいかどうかわからない。ExtJSのトレパネルにドラッグドロップ機能を作成中にthis.elがnullです。
次のように私のコードは次のとおりです。
CustomChart.js
ファイルの内容
Ext.define('dd.view.CustomChart', {
extend : 'Ext.panel.Panel',
alias : 'widget.customChart',
layout : {
type : 'vbox',
align : 'stretch'
},
initComponent : function() {
this.items = [
{
xtype : 'textfield',
name : 'values',
fieldLabel : 'Drop values here'
}
];
this.callParent(arguments);
}
});
次のように私はAttritionViewer
ファイル内でこのCustomChart
パネルを使用しています:
Ext.define('dd.view.AttritionViewer', {
extend : 'Ext.panel.Panel',
alias : 'widget.attritionViewer',
title : 'View attrition by dimensions',
layout : 'border',
initComponent : function() {
this.items = [
{
xtype : 'treepanel',
title : 'Select dimensions',
store : 'Dimensions',
rootVisible : false,
region : 'west',
height : '100%',
width : '20%',
viewConfig : {
plugins : {
ptype : 'treeviewdragdrop',
ddGroup: 'GridExample'
}
}
},
{
xtype : 'panel',
region : 'center',
layout : {
type : 'vbox',
align : 'stretch'
},
items : [
{
xtype : 'customChart',
flex : 1
}
]
}
];
this.callParent(arguments);
}
});
あなたは上記のコードで見ることができるように私はtreepanelのためにとddGroup
を設定しました。今私はそれがコントローラのinit()
メソッドに入れているので、次のコードを置く場所がわからないです。次のように私のコントローラのinit()
方法が見えます:
var customChartEl = Ext.widget('customChart');
var formPanelDropTarget = Ext.create('Ext.dd.DropTarget', customChartEl, {
ddGroup: 'GridExample',
notifyEnter: function(ddSource, e, data) {
console.log('inside notifyEnter() method');
//Add some flare to invite drop.
/* formPanel.body.stopAnimation();
formPanel.body.highlight(); */
},
notifyDrop : function(ddSource, e, data){
console.log('inside notifyDrop() method');
return true;
}
});
をこのコードの後、私はext-debug.js (line 7859)
でthis.el is null
エラーを取得しています。私は次に何をすべきかを知らない。
テキストフィールド内でtreepanelからノードをドラッグする方法を教えてください。
ありがとうございます!!!
このようなコアExtJsコードでエラーが発生した場合、少なくともスタックを見て、最後に実行された_your_コードの行がわかるはずです。 – sha
@sha、あなたのコメントのおかげで、私はスタックトレースを得ることができるか分からない。 Firefoxのスタックトレースを表示する方法を教えてください。 – Shekhar
私はFFをあまり使っていませんが、Chromeでは例外メッセージの左側に赤い三角が表示されます。 – sha