不做浮躁的人
正在行走的人...
posts - 171,  comments - 51,  trackbacks - 0

接上面,继续讨论TreeRPCController。该类在TreeLoadingController上扩充了以下方法:
1:doMove的部分代码:
var params = {
   // 移动的节点以及节点所在的树
   child: this.getInfo(child),
   childTree: this.getInfo(child.tree),
   // 移动目的树,目的节点,以及目的位置。
   newParent: this.getInfo(newParent),
   newParentTree: this.getInfo(newParent.tree),
   newIndex: index
  };

  var success;

  this.runRPC({  
   url: this.getRPCUrl('move'),
   
   load: function(response){
    success = this.doMoveProcessResponse(response, child, newParent, index) ;
   },
   //同步处理
   sync: true,
   //锁定操作的两个节点。
   lock: [child, newParent],
   params: params
  });
2:doRemoveNode
   var params = {
   node: this.getInfo(node),
   tree: this.getInfo(node.tree)
  }

  this.runRPC({
    url: this.getRPCUrl('removeNode'),
    load: function(response){
     this.doRemoveNodeProcessResponse(response, node, callObj, callFunc)
    },
    params: params,
    lock: [node]
  });

3:doCreateChild
var params = {
    tree: this.getInfo(parent.tree),
    parent: this.getInfo(parent),
    index: index,
    data: output
   }

   this.runRPC({
    url: this.getRPCUrl('createChild'),
    load: function(response) {
     // 建议采用死数据?
     this.doCreateChildProcessResponse( response, parent, index, callObj, callFunc)
    },
    params: params,
    lock: [parent]
   });

posted on 2006-11-22 23:19 不做浮躁的人 阅读(791) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 

<2006年11月>
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

常用链接

留言簿(9)

随笔分类(31)

随笔档案(75)

文章分类(1)

文章档案(3)

搜索

  •  

最新评论

阅读排行榜

评论排行榜