zoukankan      html  css  js  c++  java
  • easyui 下拉树改造

     

    <select id="cc" style=" 250px"></select>                

    <div id="sp">                    

    <div style="color: #99BBE8; background: #fafafa; padding: 5px;">                        

    <input id="roleSearch" class="easyui-searchbox" data-options="prompt:'请输入角色名',searcher:doSearch" style=" 200px"></input>                    

    </div>

                        <div style="position: absolute; height: 200px; overflow: auto">                       

      <div style="padding: 10px;">                          

       <ul id="roleTree" class="easyui-tree"></ul>                        

        </div>

                 </div>

      </div>

    <script>

    $(function(){

        $('#cc').combo({        

    editable: false,        

    panelHeight: 250,        

    onShowPanel: function () {            

    $("#roleSearch").textbox('setValue', '');        

         $('#roleTree').tree({     

                url: 'EditUser.aspx?action=bindrole'          

       })        

    }    

    });  

       $('#sp').appendTo($('#cc').combo('panel'));

        $('#roleTree').tree({        

    checkbox: true,        

    url: 'EditUser.aspx?action=bindrole',        

    onCheck: function (node, checked) {            

    var nodes = $('#roleTree').tree('getChecked');            

    var delID = [];            

    var roletext = [];            

    $.each(nodes, function (index, item) {

                    delID.push(item.id);                

    roletext.push(item.text);            

    });            

    $('#hiderole').val(delID.join(","));            

    $('#cc').combo('setText', roletext.join(','));         },        

    onLoadSuccess: function () {            

    $("#roleTree").tree("collapseAll");        

    }    

    });

    /角色搜索 function doSearch(value) {    

    if (value != "") {        

    $.ajax({            

    type: "post",//使用get方法访问后台            

    dataType: "json",            

    url: "RolesManage.aspx?action=searchRole",            

    data: { rolename: value },            

    cache: false,            

    success: function (data) {                

    $('#roleTree').tree('loadData', data);            

    }

            });    

    } else {        

    $('#roleTree').tree({            

    url: 'EditUser.aspx?action=bindrole'        

    })    

    }

    }

    })

    </script>

  • 相关阅读:
    注册时按钮上的时间倒计时
    不能修改/删除/添加数据.(NTFS问题)
    站在2009年的门槛上
    超强PHP分页类(转自PHPCHINA)
    System.Web.Caching.Cache类 缓存 各种缓存依赖
    Wxpython快速构建GUI窗口程序
    Python2 和 Python3 有哪些差别
    12306数据库遭泄露,请尽快修改密码
    王欣复出后的第一款产品
    在命令行打开安卓UI界面
  • 原文地址:https://www.cnblogs.com/yshj/p/4024667.html
Copyright © 2011-2022 走看看