• EasyUI Tree 动态传递参数


    1、问题背景

      一般出现在加载的时候,传递参数给后台,进行数据筛选,然后在加载tree渲染数据。所谓动态参数,可以是你的上一级节点node,或者是根节点node。

    2、涉及方法

      onBeforeLoad(node,param),需要给的参数在这个方法后面赋值,比如:

    var rootNode = $(this).tree('getRoot',node.target);
    param.typeId = rootNode.id;

      这样typeId 就作为动态参数,传递给了后台,后台获取typeId这个参数,进行数据筛选以达到目的。

    $("#typeTree").tree({
            url: "${basePath}/cascade/cascadePolicyAction_getDataRuleJsonTree.do",
            method: 'get',
            cascadeCheck:true,
            checkbox:false,
            animate:true,
            /* queryParams:{}, */
            loadFilter: function(data){
                if (data.treeNodes){  
                    return data.treeNodes;  
                } else {  
                    return data;
                }  
            },
            onSelect:function(node){
                if($("#"+node.id).length != 0){
                    $("#"+node.id).remove();
                }else{
                    var html = '<div id="'+node.id+'" class="card-box shcemeinfocheck active">'
                    +'<div class="card-box-content"><p>'+node.text+'</p></div>'
                    +'</div>';
                    $("#typeDiv").append(html);
                }
                setID(node.id);
            },
            onBeforeLoad:function(node,param){
                param.type = type;
            }
        })
    $("#typeTree").tree("reload");//重新加载数据
  • 相关阅读:
    JS面向对象的程序设计
    dede 调用自定义图片时新增了很多html结构的解决方法
    dedecms arclist 栏目文章列表调用标签
    POJ 3145 Harmony Forever
    URAL K-based Numbers(1-3)
    POj 3420
    Ural 1004 FLOYD最小环问题
    noip2016提高组总结
    POJ 2566 Bound Found
    POJ 1639度限制生成树
  • 原文地址:https://www.cnblogs.com/goloving/p/8483969.html
Copyright © 2020-2023  润新知