Hi there i was wondering if someone can give advice how to implement a editable tree for ext components as used in the sencha architect itself.
I think there are many solutions for doing this, my first try was to bind the treestore records (nodeInterface) direct to the container components. Like in the code snippet bellow.
But then i realized that the component methods and the nodeInterface seem to have the same
interface.
So maybe the best way is to extend the Treestore to use components in some way.
For example by mixin the nodeinterface...
Thank you for bringing in your experience
PHP Code:
function registerEvents (record, cmp){
record.cmp = cmp;
record.on({
move:function(){ },
remove:function(){
record.cmp.remove();
},
insert:function(){ },
append:function(){ } });
}/** assign rootNode to rootCmp**/
var rootNode = Ext.getCmp("treePanel").getRootNode();
var rootCmp = Ext.getCmp("rootCmp");
registerEvents(rootNode, rootCmp);
Ext.getCmp("treeView").on({
itemadd:function(recordNodes, index, node, eOpts){
/** since were useing a nodeInterface records will be nodes **/ recordNodes.forEach(function(recordNode){
var parentNode = recordNode.parentNode || rootNode;
var cmp = Ext.create('Ext.container.Container', {
width: 80,
height: 66,
resizable: {
widthIncrement:80,
heightIncrement:66,
minWidth:80,
minHeight:66
}
});
parentNode.cmp.add(cmp);
registerEvents(recordNode, cmp); } );
}});