资源描述:
《第十二讲ExtJS组件之TreePanel(下).doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、示例一:树的一些常用配置属性。Ext.onReady(function(){varloader=newExt.tree.TreeLoader({url:"treedata.js"});varroot=newExt.tree.TreeNode({id:"root",text:"根节点"});root.appendChild(newExt.tree.TreeNode({id:"child1",text:"子节点1"}));root.appendChild(newExt.tree.TreeNode({id:"child2",text:"子节点2"}));vartree=newExt.tre
2、e.TreePanel({renderTo:"TestTree",root:root,width:400,height:400,animate:false,//收缩动画autoHeight:true,//自动高度enableDrag:true,//是否可以拖动enabled:true,//drap和dropenableDrop:true,//放置节点lines:false,//节点间虚线//rootVisible:false,//是否显示根节点trackMouseOver:true,//是否进过时效果useArrows:true//是否使用小箭头});});2.Ext.onReady
3、(function(){Ext.BLANK_IMAGE_URL="../Ext/resources/images/default/s.gif";Ext.QuickTips.init();//根节点varroot=newExt.tree.TreeNode({id:"root",text:"根节点"});root.appendChild(newExt.tree.TreeNode({id:"childNode",text:"静态子节点1"}))root.appendChild(newExt.tree.AsyncTreeNode({id:"childNode2",text:"静态子节点2",
4、loader:newExt.tree.TreeLoader({url:"treedata.js"})}))varmytree=newExt.tree.TreePanel({renderTo:"hello",id:"mytree",title:"动态树",width:200,height:300,root:root,animate:false,//收缩动画autoHeight:true,//自动高度enableDrag:true,//是否可以拖动//enabledDD:true,//drap和dropenableDrop:true,//放置节点//lines:false,//节点间虚线
5、//rootVisible:false,//是否显示根节点//trackMouseOver:true,//是否进过时效果,默认时为trueuseArrows:true//是否使用小箭头});});示例二:节点的一些常用配置属性。Ext.onReady(function(){Ext.BLANK_IMAGE_URL="../Ext/resources/images/default/s.gif";Ext.QuickTips.init();varloader=newExt.tree.TreeLoader({url:"treedata.js"});varroot=newExt.tree.Tre
6、eNode({id:"root",text:"根节点",checked:true,//true则在text前有个选中的复选框,false则在text前有个选中的复选框,默认没有任何框框expanded:true,//是否展开qtip:"根节点",//提示信息singleClickExpand:true//单击文本展开});root.appendChild(newExt.tree.TreeNode({id:"child1",text:"子节点1"}))root.appendChild(newExt.tree.TreeNode({id:"child2",text:"子节点2"}))roo
7、t.appendChild(newExt.tree.AsyncTreeNode({id:"child3",text:"静态子节点3",loader:newExt.tree.TreeLoader({url:"treedata.js"})}))varmytree=newExt.tree.TreePanel({renderTo:"hello",id:"mytree",title:"树",width:200,height:300,root:root});});2.