ツリー パネルにカスタム オブジェクトをツリーノードとして追加したいと考えていました。として使用されます。
var complex_object = {....}
myTree.getRootNode().appendChild(new MyNode(complex_object));
そのような機能を実装するためExt.data.NodeInterface
に、ツリーノードへの共通インターフェイスを提供するものを見つけました。というわけで伸ばしてみました。これがその方法です。
var MYNS = {
TreeNode: new Ext.Class({
protocol : "",
displayName : "",
extend: 'Ext.data.NodeInterface',
constructor : function(line) {
this.protocol = get_protocol(line);
this.displayName = get_display_name(line);
var configObj = {
id : this.protocol + "-" + this.displayName,
text : this.displayName,
leaf : true,
iconCls : protocol+"-user"
};
this.callParent([configObj]);
}
})
}
結局のところ、これは の拡張クラスを作成しませんExt.data.NodeInterface
。ただし、親から機能しないオブジェクト bud を作成します。
var a = new MYNS.TreeNode(...);
a.appendChild(); // throws error
私はそれを間違っていますか?どのように正しく行うのですか?