重构tree方法新加(接上篇)清除tree缓存

 1       clear:function(jq){
 2                                                               return jq.each(function(oj){
 3                                                               var tree=$.data(this,"tree").tree;
 4                                                               tree.find("div.tree-node-selected").removeClass("tree-node-selected");
 5                                                               var cc=tree.tree("getChecked");
 6                                                              for(var i=0;i<cc.length;i++){
 7                                                                    tree.tree("uncheck",cc[i].target);
 8                                                                      }
 9                                                           });//可直接拷贝,无需改动。用法如下:
10 
11                                                                  $('#treeid').tree("clear");
12 
13  

 

posted @ 2015-09-18 16:30  艺术代码  阅读(421)  评论(0编辑  收藏  举报