EasyUI tree扩展获取实心节点

来源:互联网 发布:开实体店淘宝进货 编辑:程序博客网 时间:2024/05/17 09:10
[javascript] view plaincopy
  1. <script type="text/javascript">  
  2.             //扩展 获得tree 的实心节点    
  3.             $(function(){  
  4.                 $.extend($.fn.tree.methods,{  
  5.                     getCheckedExt: function(jq){  
  6.                         var checked = $(jq).tree("getChecked");                     //获取选中的选项 也就是打钩的   
  7.                         var checkbox2 = $(jq).find("span.tree-checkbox2").parent(); //获取实心的选项 也就是实心方块的   
  8.                         $.each(checkbox2,function(){  
  9.                             var node = $.extend({}, $.data(this"tree-node"), {  
  10.                                 target : this  
  11.                             });  
  12.                             checked.push(node);  
  13.                         });  
  14.                         return checked;  
  15.                     }  
  16.                 });  
  17.             })  
  18.             /* 
  19.             注: checkbox0是没有被选中的  
  20.                 checkbox1是被选中打钩的  
  21.                 checkbox2是实心节点 
  22.             */  
  23.             function getSelect(){  
  24.                  var solids = $("#trueULid").tree("getCheckedExt");  
  25.                  var nodes = '';  
  26.                  $.each(solids,function(){  
  27.                      nodes+=this.id+',';  
  28.                  });  
  29.                  $("#typeRole").val(nodes);  //将所有ID值保存   
  30.             }     
  31.         </script>  

[html] view plaincopy
  1. <input type="hidden" id="typeRole" name="typeRole"  value="" />  
隐藏域保存所有树节点ID传入后台

[html] view plaincopy
  1. <input onclick="getSelect();" type="submit" value="提交" class="submit" class="submit" />  







0 0
原创粉丝点击