Skip to content

Instantly share code, notes, and snippets.

@alvin2ye
Created July 18, 2009 02:59
Show Gist options
  • Save alvin2ye/149386 to your computer and use it in GitHub Desktop.
Save alvin2ye/149386 to your computer and use it in GitHub Desktop.
ext3 ajax tree click
Ext.onReady(function(){
// shorthand
var Tree = Ext.tree;
var tree = new Tree.TreePanel({
useArrows: true,
preloadChildren :true,
autoScroll: true,
animate: true,
containerScroll: true,
border: false,
// auto create TreeLoader
root: {
nodeType: 'async',
text: 'Primy 进口',
draggable: false,
id: 4
},
loader: new Ext.tree.TreeLoader({
dataUrl:'/home/test_tree_text'
})
});
tree.render('nav-tree');
tree.getRootNode().expand();
tree.on('click', function(n, e){
var sn = this.selModel.selNode || {}; // selNode is null on initial selection
var el = Ext.getCmp('ct-hd')
var tb = el.getTopToolbar();
el.setTitle(n.text);
tb.addButton({ text: '创建分单', iconCls: 'settings' });
tb.doLayout();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment