欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

jQuery EasyUI 表单 – 创建树形下拉框(ComboTree)

程序员文章站 2022-05-18 20:50:11
...

方法一:从标记创建组合树(combotree)

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="easyui.css">
</head>
<body>
<input id="cc" class="easyui-combotree" multiple style="width: 190px;" data-options="url: 'event1.json'" panelHeight="300px">
<!--如果报错405,加上method:'get'即可-->
<script src="layui/jquery-3.3.1.js"></script>
<script src="jquery.easyui.min.js"></script>
</body>
</html>

方法二:使用 javascript 创建组合树(combotree)

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="easyui.css">
</head>
<body>
<input id="cc" class="easyui-combotree" multiple style="width: 190px;"  panelHeight="300px">
<script src="layui/jquery-3.3.1.js"></script>
<script src="jquery.easyui.min.js"></script>
<script>
    $('#cc').combotree({
        url: 'event.json',
<!--如果报错405,加上method:'get'即可-->
    });
</script>
</body>
</html>

需要注意的是jQuery EasyUI 表单 – 创建树形下拉框(ComboTree)

需要在服务器下打开才可以,如本地服务器localhost,http

演示地址:https://hanlei525.github.io/EasyUI-Combotree/easyui.html

最后是easyui官方文档