Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ext.define("ast.ast1949.util.TreeSelectorWin",{
- extend:"Ext.Window",
- initComponent:function(){
- var tree=Ext.create("ast.ast1949.util.Tree",{
- rootCode:this.getRootCode(),
- treeModel:this.getTreeModel(),
- queryUrl:this.getQueryUrl(),
- rootexpanded:false
- });
- var c={
- layout:"fit",
- items:[tree],
- buttons:[{
- text:"选择",
- iconCls:"accept16",
- scope:this,
- handler:function(btn,e){
- //tree选中项
- var model=tree.getSelectionModel().getLastSelected();
- this.callbackFn(model);
- }
- },{
- text:"关闭",
- iconCls:"close16",
- scope:this,
- handler:function(btn,e){
- this.close();
- }
- }]
- };
- Ext.applyIf(this,c);
- this.callParent();
- },
- rootCode:"",
- treeModel:"CategoryTreeModel",
- queryUrl:Context.ROOT+"/path/to/tree/node.htm",
- config:{
- queryUrl:null,
- rootCode:null,
- initCode:null,
- treeModel:"CategoryTreeModel"
- },
- callbackFn:function(nodeInterface){
- },
- initTree:function(codelength){
- var path="/";
- codelength=codelength||4;
- var pathArr=new Array();
- if(this.getInitCode()!=null && this.getInitCode().length>0){
- for(var i=this.getRootCode().length;i<=this.getInitCode().length;i=i+codelength){
- pathArr.push(this.getInitCode().substring(0,i));
- }
- }
- if(pathArr.length>0){
- path=path+pathArr.join("/");
- this.child("treepanel").selectPath(path, "id");
- }else{
- path=path+this.getRootCode();
- // this.child("treepanel").expandPath(path, "id");
- this.child("treepanel").getRootNode().expand();
- }
- }
- });
Add Comment
Please, Sign In to add comment