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 ...
随机推荐
- linux第13天 生产者与消费者
pthread_cond_t my_condition = PTHREAD_COND_INITIALIZER; pthread_mutex_t mutex = PTHREAD_MUTEX_INIT ...
- 关于内存 GetMemory( ) 笔试分析
1. #include<stdio.h>#include<string.h>void GetMemory(char *p){ p=(char *)malloc(100); }i ...
- Android 5.0新特性了解(二)----RippleEffect
1.本文介绍的是Android5.0中其中一个炫酷的效果,点击水波纹扩散效果( RippleEffect),以下介绍的实现方式都是调用Android5.0的新API,并非自定义实现,所以支持在Andr ...
- (转)Aspone.Cells设置Cell数据格式 Setting Display Formats of Numbers and Dates
Setting Display Formats Using Microsoft Excel: Right-click on any desired cell and select Format Cel ...
- IMapDocument interface
Provides access to members that control the reading and writing of map document files.(提供访问的成员,控制读 ...
- mysql 导出过长的数字列时变科学计数法问题解决办法
--mysql 导出数据时, 数字类型的列如果位数过长,变为科学技术发问题 concat('\t',a.IDCARD_NO) 例子: select concat('\t',a.IDCA ...
- 利用API自动建立GL科目段组合
1.检查存在性,如没有则新增 fnd_flex_keyval.validate_segs('CREATE_COMBINATION' ...
- 160920、springmvc上传图片不生成临时文件
springMVC上传图片时候小于10k不会再临时目录里面生成临时文件,需要增加一个配置 <property name="maxInMemorySize" value=&qu ...
- Access数据库导入到SQL Server 2005 Express中
安装好SQL Server 2005 Express后,再安装SQL Server Management Studio Express CTP就可以很方便的使用控制台进行数据库的管理.但SQL Ser ...
- Linux程序存储结构与进程结构堆和栈的区别【转】
转自:http://www.hongkevip.com/caozuoxitong/Unix_Linux/24581.html 红客VIP(http://www.hongkevip.com):Linux ...