Jquery EasyUI Combotree展开所有父节点

Jquery EasyUI Combotree获取树完整路径

Jquery EasyUI tree展开所有父节点

Jquery EasyUI tree获取完整路径

================================

©Copyright 蕃薯耀 2018年5月11日

https://www.cnblogs.com/fanshuyao/

  1. /**
  2. * 根据叶子节点展开所有父节点
  3. * @param treeObj 树对象,(combotree的树对象获取:var treeObj = comboObj.combotree("tree");)
  4. * @param node 叶子节点
  5. */
  6. function expandParent(treeObj, node){
  7. var parentNode = treeObj.tree("getParent", node.target);
  8. if(parentNode != null && parentNode != "undefined"){
  9. treeObj.tree("expand", parentNode.target);
  10. expandParent(treeObj, parentNode);
  11. }
  12. };
  13. /**
  14. * tree初始化赋值并展开所有父节点
  15. * @param treeObj 树对象
  16. * @param leafValue 叶子节点的值
  17. */
  18. function treeInitValueAndExpand(treeObj, leafValue){
  19. var nodesChecked = treeObj.tree("getChecked");//获取选中的值
  20. if(nodesChecked.length > 0){
  21. for(var i=0; i<nodesChecked.length; i++){
  22. expandParent(treeObj, nodesChecked[i]);
  23. }
  24. }
  25. };
  26. /**
  27. * 根据叶子节点选中的值,获取树整个路径的名称
  28. * @param treeObj 树对象,(combotree的树对象获取:var treeObj = comboObj.combotree("tree");)
  29. * @param node 叶子节点
  30. */
  31. function getTreePathNames(treeObj, node){
  32. var pathName = node.text;
  33. var parentNode = treeObj.tree("getParent", node.target);
  34. if(parentNode != null && parentNode != "undefined"){
  35. pathName = getTreePathNames(treeObj, parentNode) + " > " + pathName;
  36. }
  37. return pathName;
  38. };
  39. /**
  40. * 根据叶子节点选中的值,获取树整个路径的名称
  41. * @param combotreeId 唯一ID
  42. * @param leafValue 叶子节点的值
  43. */
  44. function getCombotreePathNames(combotreeId, leafValue){
  45. var combotreeObj = $("#"+combotreeId);
  46. var treeObj = combotreeObj.combotree("tree");
  47. var nodesChecked = treeObj.tree("getChecked");//获取选中的值
  48. var pathName = "";
  49. if(nodesChecked.length > 0){
  50. for(var i=0; i<nodesChecked.length; i++){
  51. pathName += getTreePathNames(treeObj, nodesChecked[i]);
  52. }
  53. }
  54. return pathName;
  55. };
  56. /**
  57. * combotree初始化赋值并展开所有父节点
  58. * @param combotreeId 唯一ID
  59. * @param leafValue 叶子节点的值
  60. */
  61. function combotreeInitValueAndExpand(combotreeId, leafValue){
  62. var combotreeObj = $("#"+combotreeId);
  63. var treeObj = combotreeObj.combotree("tree");
  64. combotreeObj.combotree("setValue", leafValue);//赋值
  65. treeInitValueAndExpand(treeObj, leafValue);
  66. };

================================

©Copyright 蕃薯耀 2018年5月11日

https://www.cnblogs.com/fanshuyao/

Jquery EasyUI Combotree和 EasyUI tree展开所有父节点和获取完整路径的更多相关文章

  1. Jquery EasyUI Combotree根据选中的值展开所有父节点

    Jquery EasyUI Combotree根据选中的值展开所有父节点  Jquery EasyUI Combotree 展开父节点, Jquery EasyUI Combotree根据子节点选中的 ...

  2. EasyUI的tree展开所有的节点或者根据特殊的条件控制展示指定的节点

    展示tree下的所有节点$(function(){ $('#t_funinfo_tree').tree({ checkbox: true, url:"<%=basePath %> ...

  3. jQuery中兄弟元素、子元素和父元素的获取

    我们这里主要总结jQuery中对某元素的兄弟元素.子元素和父元素的获取,原声的Javascript代码对这些元素的获取比较麻烦一些,而jQuery正好对这些方法进行封装,让我们更加方便的对这些元素进行 ...

  4. jQuery之导航菜单(点击该父节点时子节点显示,同时子节点的同级隐藏,但是同级的父节点始终显示)

    注:对于同一个对象不超过3个操作的,可直接写成一行,超 过3个操作的建议每行写一个操作.这样可读性较强,可提高代码的可读性和可维护性 核心代码: $(".has_children" ...

  5. Jquery EasyUI Combotree 初始化赋值

    Jquery EasyUI Combotree 初始化赋值 ================================ ©Copyright 蕃薯耀 2018年5月7日 https://www. ...

  6. Jquery EasyUI Combotree只能选择叶子节点且叶子节点有多选框

    Jquery EasyUI Combotree只能选择叶子节点且叶子节点有多选框 Jquery EasyUI Combotree单选框,Jquery EasyUI Combotree只能选择叶子节点 ...

  7. easyui.combotree.search.js

    (function ($) { //combotree可编辑,自定义模糊查询 $.fn.combotree.defaults.editable = true; $.extend($.fn.combot ...

  8. EasyUI ComboTree无限层级异步加载示例

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="EasuUIDemoTree.a ...

  9. easyui Combotree 怎么加载数据 支持多选

    1.开发环境vs2012 mvc4  c# 2.HTML前端代码 <%@ Page Language="C#" AutoEventWireup="true" ...

随机推荐

  1. ssm数据库异常问题

    org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Reflecti ...

  2. 3ds max学习笔记(八)-- 实例操作(直行楼梯)

    1.选择要复制的物体,执行[工具]/[阵列]命令,弹出对话框: 2.参数说明: 应用: 1.[自定义]/[单位设置],将单位改为mm 在顶视图中,创建长方体,长1600,宽300,高度150 2.在前 ...

  3. pygame-KidsCanCode系列jumpy-part7-游戏启动/结束画面

    通常一个游戏启动(start)或结束(game over)时,都会显示一个画面,来引导用户.这节,我们学习如何处理这块逻辑. 其实之前,我们已经预留了2个函数,只要把它实现即可: def show_s ...

  4. Unity插件扩展中组件常用的几个方法

    最近为美术编写一个Unity编辑器的扩展,主要为了减轻美术在修改预制对象时的机械化操作的繁琐和出错.具体实现的几个功能: 1.删除指定组件: 2.复制.粘贴指定的组件: 3.重新关联新的属性: 4.重 ...

  5. Siamese网络

    1.       对比损失函数(Contrastive Loss function) 孪生架构的目的不是对输入图像进行分类,而是区分它们.因此,分类损失函数(如交叉熵)不是最合适的选择,这种架构更适合 ...

  6. FPGA基础之逻辑单元(LE or LC)的基本结构

    原帖地址: https://blog.csdn.net/a8039974/article/details/51706906/ 逻辑单元在FPGA器件内部,是完成用户逻辑的最小单元.逻辑单元在ALTER ...

  7. 创建MySQL用户 赋予某指定库表的权限

    摘自: http://renxiangzyq.iteye.com/blog/763837 update ERROR 1364 (HY000): Field 'ssl_cipher' doesn't h ...

  8. AsyncHttpSupport并发发送请求

    public class AsyncHttpSupportTest { @InjectMocks private AsyncHttpSupport asyncHttpSupport; @Mock pr ...

  9. WPF双向数据绑定总结

    参考官方:https://docs.microsoft.com/zh-cn/dotnet/framework/wpf/data/data-binding-wpf 实例程序:https://files. ...

  10. Python随机字符串验证码

    def code_get(self): source = ['] #数字验证码 # source = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H','I','J', ...