Easyui主要组件用法
Easyui主要组件用法说明:
1. combogrid用法
说明:combogrid可提供翻页列表的数据选择并可进行数据的过滤查询(查询的传人参数为q,可在控制器中获取这个参数传过来的值,下面的示例区别为单独和批量的combogrid提供的数据操作)
以下面输入框为列:
1.<input type="text" id="org" name="org" required="true" class="input" style="width:188px;"/>
2.<input type="text" id="org" name="org" required="true" class="input easyui-validatebox" style="width:188px;"/><!—错误的写法-->
1-1:combogrid(添加)
$("#org").combogrid({
onLoadError:showError, <!—出错后的调用函数-->
panelWidth:450, <!—弹出后面板的宽度-->
idField:'so_id', <!—存储到数据库后的值-->
textField:'so_name', <!—选择后的可见名-->
pagination:true, <!—是否显示翻页导航-->
rownumbers:true, <!—是否显示行号-->
mode:'remote', <!—远程调用-->
url:'${path}/sys/sys_orgPage.do', <!—调用的翻页列表动作-->
columns:[[
{field:'so_name',title:'机构名称',width:100},
{field:'so_type',title:'机构类型',width:120}
]], <!—弹出后显示的列表表头-->
onBeforeLoad:function(param){ <!—设置refresh是否重新计算翻页总数 -->
param.refresh="1";
},
onSelect:function(index,data){
<!—下拉选择后做其他的事情-->
}
}).combogrid("panel").css("overflow","hidden");<!—控制某些浏览器出现双滚动条的情况-->
注意: 在表单保存时还需做如下操作:
//单独添加时
if($('#org').combogrid("getValue") == $('# org'').combogrid("getText")) {
$('# org'').combogrid("clear");
$("#org'").combogrid("grid").datagrid("load", {"refresh":"1"});
}
//批量添加时
var combonames = $("#input[comboname=org]");
$.each(combonames, function(i, j) {
if($(j).combogrid("getValue") == $(j).combogrid("getText")) {
$(j).combogrid("clear");
$(j).combogrid("grid").datagrid("load", {"refresh":"1"});
}
});
主要是为了防止用户恶意输入列表中不存在的数据,以及清空不存在的数据后重新加载翻页列表
1-2: combogrid(修改)
var init=false;
var sel=false;
$("#org").combogrid({
onLoadError:showError, <!—出错后的调用函数-->
panelWidth:450, <!—弹出后面板的宽度-->
idField:'so_id', <!—存储到数据库后的值-->
textField:'so_name', <!—选择后的可见名-->
pagination:true, <!—是否显示翻页导航-->
rownumbers:true, <!—是否显示行号-->
mode:'remote', <!—远程调用-->
url:'${path}/sys/sys_orgPage.do', <!—调用的翻页列表动作-->
columns:[[
{field:'so_name',title:'机构名称',width:100},
{field:'so_type',title:'机构类型',width:120}
]], <!—弹出后显示的列表表头-->
onBeforeLoad:function(param){ <!—设置refresh是否重新计算翻页总数 -->
param.refresh="1";
},
onLoadSuccess:function(data){ <!—针对单独 -->
if(!init){ <!—防止重复的判断 -->
sel=false; <!—设置选中后关联其他的文本值的判断 -->
init=true;
$(this).combogrid("setText","${ so_name }");<!—强制设置翻页列表的数据不在当前的列表的清空 -->
}
},
onLoadSuccess:function(data){ <!—针对批量 -->
if (!$(this).attr("init")) {
$(this).attr("init", true);
$(this).combogrid("setText", $(this).attr("txt"));
}
},
onSelect:function(index,data){
if (!sel) {
sel = true;
} else {
$('#XX).text(data.so_name);
}
}
}).combogrid("panel").css("overflow","hidden");<!—控制某些浏览器出现双滚动条的情况-->
注意: 在表单保存时还需做如下操作:
//单独修改时
if($('#org').combogrid("getValue") == $('# org'').combogrid("getText")) {
$('# org'').combogrid("clear");
$("#org'").combogrid("grid").datagrid("load", {"refresh":"1"});
}
//批量修改时
var combonames = $("#form input[comboname=org]");
$.each(combonames, function(i, j) {
if($(j).combogrid("getValue") == $(j).combogrid("getText")) {
$(j).combogrid("clear");
$(j).combogrid("grid").datagrid("load", {"refresh":"1"});
}
});
主要是为了防止用户恶意输入列表中不存在的数据,以及清空不存在的数据后重新加载翻页列表
2. combobox用法
说明:combobox可提供下拉的数据选择并可进行数据的过滤查询(查询的传人参数为q,可在控制器中获取这个参数传过来的值)
以下面输入框为列:
1.<input type="text" id="org" name="org" required="true" class="input" style="width:188px;"/>
2.<input type="text" id="org" name="org" required="true" class="input easyui-validatebox" style="width:188px;"/><!—错误的写法-->
2-1:combobox(添加&修改)
$("#org").combobox({
panelHeight:100,
mode:"remote",
url:"${path}/sys/org_list.do?q=",
valueField:'so_id',
textField:'so_name'
});
$('# org ').combobox("options").url="${path}/ sys/org_list.do";
注意: 在表单保存时还需做如下操作:
var select = $('#org);
var panel = select.combobox("panel");
var selectedOption = panel.find("div.combobox-item-selected");
if(selectedOption.length==0){
select.combobox("setValue","");
select.combobox("setText","");
var url = select.combobox("options").url;
select.combobox("reload",url+"&q=");
select.combobox("options").url = url;
}
主要是为了防止用户恶意输入不存在的数据,以及清空不存在的数据后重新加载下拉数据
3. combotree用法
3-1: combotree(添加和修改)
说明:combotree可提供下拉的树形数据选择(可提供复选、单选的等功能)
以下面输入框为列:
1.<input type="text" id="org" name="org" required="true" class="input" style="width:188px;"/>
$("#org").combotree({
data:服务器提供的数据,
onLoadSuccess:function(node, data){
$("#org").tree("collapseAll");<!—关闭树节点-->
var root = $("#tree").tree("getRoot");<!—得到根节点-->
if (root != null) {
$("#tree").tree("expand", root.target); <!—展开第一个根节点-->
}
}
});
var selected = $("#org").combotree("tree").tree("find", xx); <!—找到某个节点-->
if(selected!=null){
$("#org ").combotree("tree").tree("select", selected.target); <!—选中节点-->
$("#org").combotree("tree").tree("expandTo", selected.target); <!—展开节点-->
}
4.tree用法
4-1: tree(添加和修改)
说明:tree可提供下拉的树形菜单数据选择
以下面输入框为列:
1.<input type="text" id="org" name="org" required="true" class="input" style="width:188px;"/>
$("#org").otree({
data:服务器提供的数据,
onLoadSuccess:function(node, data){
$("#org").tree("collapseAll");<!—关闭树节点-->
var root = $("#tree").tree("getRoot");<!—得到根节点-->
if (root != null) {
$("#tree").tree("expand", root.target); <!—展开第一个根节点-->
}
}
});
var selected = $("#org").tree ("tree").tree("find", xx); <!—找到某个节点-->
if(selected!=null){
$("#org ").tree ("tree").tree("select", selected.target); <!—选中节点-->
$("#org").tree ("tree").tree("expandTo", selected.target); <!—展开节点-->
}
Easyui主要组件用法的更多相关文章
- Easyui部分组件讲解
Easyui部分组件讲解 目 录 1.... Accordion(可折叠标签)... 2 1.1 实例... 2 1.2 参数... 3 2.... DateBo ...
- 对easyui datagrid组件的一个小改进
#对easyui datagrid组件的一个小改进 ##问题 在实际项目中使用datagrid时,受版面限制,有时候表格不能太大,这时候表格里面的内容就不能完全显示,用户需要经常拖动调整列宽才能看完整 ...
- easyUI panel组件
easyUI panel组件: 属性的使用: <!DOCTYPE html> <html lang="en"> <head> <meta ...
- easyUI progressbar组件
easyUI progressbar组件: <!DOCTYPE html> <html lang="en"> <head> <meta c ...
- easyUI linkbutton组件
easyUI linkbutton组件: <!DOCTYPE html> <html lang="en"> <head> <meta ch ...
- easyUI tootip组件使用
easyUI tootip组件使用: <!DOCTYPE html> <html lang="en"> <head> <meta char ...
- easyUI resizable组件使用
easyUI resizable组件使用: <!DOCTYPE html> <html lang="en"> <head> <meta c ...
- easyUI droppable组件使用
easyUI droppable组件使用: <!DOCTYPE html> <html lang="en"> <head> <meta c ...
- easyUI draggable组件使用
easyUI draggable组件使用: <!DOCTYPE html> <html lang="en"> <head> <meta c ...
随机推荐
- iis access denied, you do not have permission.
this kind of problems are usually caused by some IIS configuration issues, like application pool set ...
- HDU 4573 Throw the Stones(动态三维凸包)(2013 ACM-ICPC长沙赛区全国邀请赛)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4573 Problem Description Remember our childhood? A fe ...
- struts文件上传(多文件)
第01步:配置web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version= ...
- DataFrame使用mysql数据
错误提示: Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc ...
- 机器学习中的范数规则化之(一)L0、L1与L2范数(转)
http://blog.csdn.net/zouxy09/article/details/24971995 机器学习中的范数规则化之(一)L0.L1与L2范数 zouxy09@qq.com http: ...
- smarty简单介绍
smarty简单介绍 示意图如下 简单介绍smarty.class.php类的大体内容,如下: <?php class Smarty //此类就是libs中的Smarty.class.php类 ...
- 《zw版·delphi与halcon系列原创教程》zw版_THOperatorSetX控件函数列表 v11中文增强版
<zw版·delphi与halcon系列原创教程>zw版_THOperatorSetX控件函数列表v11中文增强版 Halcon虽然庞大,光HALCONXLib_TLB.pas文件,源码就 ...
- Java笔试题解答和部分面试题
面试类 银行类的问题 问题一:在多线程环境中使用HashMap会有什么问题?在什么情况下使用get()方法会产生无限循环? HashMap本身没有什么问题,有没有问题取决于你是如何使用它的.比如,你 ...
- dota玩家与英雄契合度的计算器,python语言scrapy爬虫的使用
首发:个人博客,更新&纠错&回复 演示地址在这里,代码在这里. 一个dota玩家与英雄契合度的计算器(查看效果),包括两部分代码: 1.python的scrapy爬虫,总体思路是pag ...
- 关于jQuery的bind()\trigger()\triggerHandler()
1.bind() 事件绑定. 多个事件会链式累加,而不会覆盖. 即 $("div").bind("click",funtion(){alert("te ...