easyui combotree combobox 使用例子
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="Resurces/themes/easyui.css" rel="stylesheet" />
<link href="Resurces/themes/icon.css" rel="stylesheet" />
<script src="Resurces/Javascript/jquery.min.js"></script>
<script src="Resurces/Javascript/jquery.easyui.min.js"></script>
<script>
$(function () {
$('#cc').combotree({
method: 'get', //必须指明
url: 'Data/tree_data1.json',//必须指明
editable: true, //编辑,支持模糊查询
multiple: true, //为true,出来多选框,勾选多个
required: true,
missingMessage: '不能为空,请选择',
prompt: '请选择下拉...',
onHidePanel: function () {
var _options = $(this).combobox('options');
var _data = $(this).combobox('getData');/* 下拉框所有选项 */
var _value = $(this).combobox('getValue');/* 用户输入的值 */
var _b = false;/* 标识是否在下拉列表中找到了用户输入的字符 */
for (var i = 0; i < _data.length; i++) {
if (_data[i][_options.valueField] == _value) {
_b = true;
break;
}
}
if (!_b) {
$(this).combobox('setValue', '');
}
}
});
$('#dd').combobox({
method: 'get', //必须指明
url: 'Data/combox1.json',//必须指明
valueField: 'id',
textField: 'text',
editable: true, //编辑,支持模糊查询
//multiple: true, //为true,出来多选框,勾选多个
required: true,
onChange: function (newValue, oldValue) {
reload();//实现联动
}
});
});
function reload() {
$('#dd').combobox({
method: 'reload', //必须指明
url: 'Data/combox1.json?param='+'这里是传的新值'+'&a='+Math.random()//必须指明
});
}
function GetData() {
var t = $('#cc').combotree('getData');
alert(t.length);
}
function SetDefault() {
var t = $('#cc').combotree('getData');
$('#cc').combotree('select',t[0].id);
}
function getValues() {
var t = $('#cc').combotree('getValues');
alert(t);
}
function getValue() {
var t = $('#cc').combotree('getValue');
alert(t);
}
function setValues() {
$('#cc').combotree('setValues', ['111', '112']);
}
function setValue() {
$('#cc').combotree('setValue', '11');
}
function disable() {
$('#cc').combotree('disable');
}
function enable() {
$('#cc').combotree('enable');
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="cc" />
<input id="dd" />
<input type="button" value="getValue" onclick="getValue()" />
<input type="button" value="getValues" onclick="getValues()" />
<input type="button" value="setValue" onclick="setValue()" />
<input type="button" value="setValues" onclick="setValues()" />
<input type="button" value="disable" onclick="disable()" />
<input type="button" value="enable" onclick="enable()" />
</div>
</form>
</body>
</html>
easyui combotree combobox 使用例子的更多相关文章
- 表单(上)EasyUI Form 表单、EasyUI Validatebox 验证框、EasyUI Combobox 组合框、EasyUI Combo 组合、EasyUI Combotree 组合树
EasyUI Form 表单 通过 $.fn.form.defaults 重写默认的 defaults. 表单(form)提供多种方法来执行带有表单字段的动作,比如 ajax 提交.加载.清除,等等. ...
- easyui combotree模糊查询
技术交流QQ群:15129679 让EasyUI的combobox和combotree同时支持自定义模糊查询,在不更改其他代码的情况下,添加以下代码就行了: /** * combobox和combot ...
- easyui combotree 异步树 前端写法js
简要说下使用场景: combotree下拉框第一次加载时,请求一个接口,页面上展示顶层节点们(可以理解为最顶层的节点,比如所有的一级公司): 当点击其中一个节点前面的小三角展开时,再次请求服务器接口( ...
- easyui的combobox下拉框初始化默认值以及保持该值一直显示的方法
easyui的combobox下拉框默认初始值是空,下面是实现从远程加载数据之后初始化默认值,以及让该值一直排在下拉框的最顶部的方式. 目前的需求是需要在初始化的时候添加"全部数据库&quo ...
- EasyUI ComboTree无限层级异步加载示例
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EasuUIDemoTree.a ...
- EasyUI 中 Combobox里的onChange和onSelect事件的区别
EasyUI 中 Combobox 选项发生改变时会触发 onChange,onSelect,onClick 3 个事件. 最近要做一个级联的 Combo 菜单,类似于选择地址时让用户填写省,市,区的 ...
- Jquery EasyUI Combotree和 EasyUI tree展开所有父节点和获取完整路径
Jquery EasyUI Combotree展开所有父节点 Jquery EasyUI Combotree获取树完整路径 Jquery EasyUI tree展开所有父节点 Jquery EasyU ...
- Jquery EasyUI Combotree根据选中的值展开所有父节点
Jquery EasyUI Combotree根据选中的值展开所有父节点 Jquery EasyUI Combotree 展开父节点, Jquery EasyUI Combotree根据子节点选中的 ...
- Jquery EasyUI Combotree 初始化赋值
Jquery EasyUI Combotree 初始化赋值 ================================ ©Copyright 蕃薯耀 2018年5月7日 https://www. ...
随机推荐
- Codeforces633G(SummerTrainingDay06-I dfs序+线段树+bitset)
G. Yash And Trees time limit per test:4 seconds memory limit per test:512 megabytes input:standard i ...
- LeetCode DB: Duplicate Emails
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...
- short、int、long、float、double区别
一.基本数据类型的特点,位数,最大值和最小值.1.基本类型:short 二进制位数:16 包装类:java.lang.Short 最小值:Short.MIN_VALUE=-32768 (-2的15此方 ...
- html5 图片上传 预览
<html><body><fieldset> <legend>测试</legend> <div class="form-gr ...
- CSS 小结笔记之滑动门技术
所谓的滑动门技术,就是指盒子背景能够自动拉伸以适应不同长度的文本.即当文字增多时,背景看起来也会变长. 大多数应用于导航栏之中,如微信导航栏: 具体实现方法如下: 1.首先每一块文本内容是由a标签与s ...
- MapReduce文件配置和测试
1.前提:MapReduce能配置的前提是hdfs能够正常运行 2.在1的基础上,配置两个文件: 在hadoop文件夹下配置两个文件mapred-site.xml(由mapred-site.xm ...
- 如何在 Azure 中标记 Windows 虚拟机
本文介绍在 Azure 中通过 Azure 资源管理器标记 Windows 虚拟机的不同方式.标记是用户定义的键/值对,可直接放置在资源或资源组中.针对每个资源和资源组,Azure 当前支持最多 15 ...
- 纯Css实现Div高度根据自适应宽度(百分比)调整
在如今响应式布局的要求下,很多能自动调整尺寸的元素能够做到高宽自适应,如img,通过{width:50%;height:auto;}实现图片高度跟随宽度比例调整. 然而,用的最多的标签一哥Div却不能 ...
- MySQL C API 访问 MySQL 示例
代码: /* Simple C program that connects to MySQL Database server */ #include <mysql.h> #include ...
- 团队作业8--测试与发布(Beta阶段)
展示博客 一.项目成员: 张慧敏(组长)201421122032 苏晓薇(组员)201421031033 欧阳时康(组员)201421122050 团队仓库: https://git.coding.n ...