学习笔记 – EasyUI官方网站演示[通俗易懂]

学习笔记 – EasyUI官方网站演示[通俗易懂]EasyUI官方网站演示撰写:2016/03/21更新:2016/04/07博客地址:http://www.cnblogs.com/gibbonnet/p/5362801.html演示地址:h

大家好,又见面了,我是你们的朋友全栈君。

EasyUI官方网站演示

撰写:2016/03/21
更新:2016/04/07
博客地址:http://www.cnblogs.com/gibbonnet/p/5362801.html
演示地址:http://www.jeasyui.com/tutorial/index.php

应用程序示例

使用jQuery EasyUI创建CURD应用)

  • datagrid class="easyui-datagrid"
  • dialog class="easyui-dialog"
  • form
  • messager $.messager.show

创建可以编辑的表格

<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.edatagrid.js"></script>
指定列的编辑器
editor="{type:'validatebox',options:{required:true}}"
指定载入数据、保存、更新、删除操作的服务器路径

$('#dg').edatagrid({
    url: 'get_users.php',
    saveUrl: 'save_user.php',
    updateUrl: 'update_user.php',
    destroyUrl: 'destroy_user.php'
});

创建RSS阅读器

  • layout 布局器 class="easyui-layout"
  • datagrid 表格 $('#dg').datagrid
  • tree 树 $('#t-channels').tree

布局器

region="north" border="false"
region="west"
region="center"

表格事件

onSelect 选择事件
onLoadSuccess 数据载入成功后事件

onSelect 选择事件
onLoadSuccess 数据载入成功后事件

树演示 TreeGrid

演示地址:http://www.jeasyui.com/demo/main/index.php?plugin=TreeGrid&theme=default&dir=ltr&pitem=

基本使用

<table title="Fluid Browser" class="easyui-treegrid" style="width:700px;height:250px"
       data-options="
                     url: 'treegrid_data1.json',
                     method: 'get',
                     idField: 'id',
                     treeField: 'name'
                     ">
<thead>
  <tr>
    <th data-options="field:'name'" width="50%">Name(50%)</th>
    <th data-options="field:'size'" width="20%" align="right">Size(20%)</th>
    <th data-options="field:'date'" width="30%">Modified Date(30%)</th>
  </tr>
</thead>
</table>

增加连线 lines: true

显示合计行 showFooter:true

表格动作

允许折叠 collapsible: true,

全部折叠 $('#tg').treegrid('collapseAll');

全部展开 $('#tg').treegrid('collapseAll');

展开到指定节点 $('#tg').treegrid('expandTo',21).treegrid('select',21);

复选框

属性设置 checkbox: true,

定制复选框

checkbox: function(row){
	var names = ['Java','eclipse.exe','eclipse.ini'];
	if ($.inArray(row.name, names)>=0){
		return true;
	}
}

上下文菜单

属性:onContextMenu: onContextMenu

显示菜单

function onContextMenu(e,row){
	if (row){
		e.preventDefault();
		$(this).treegrid('select', row.id);
		$('#mm').menu('show',{
			left: e.pageX,
			top: e.pageY
		});                
	}
}

定义菜单

<div id="mm" class="easyui-menu" style="width:120px;">
  <div onclick="append()" data-options="iconCls:'icon-add'">Append</div>
  <div onclick="removeIt()" data-options="iconCls:'icon-remove'">Remove</div>
  <div class="menu-sep"></div>
  <div onclick="collapse()">Collapse</div>
  <div onclick="expand()">Expand</div>
</div>

定义动作

function removeIt(){
	var node = $('#tg').treegrid('getSelected');
	if (node){
		$('#tg').treegrid('remove', node.id);
	}
}
function collapse(){
	var node = $('#tg').treegrid('getSelected');
	if (node){
		$('#tg').treegrid('collapse', node.id);
	}
}
function expand(){
	var node = $('#tg').treegrid('getSelected');
	if (node){
		$('#tg').treegrid('expand', node.id);
	}
}

可编辑表格

开始编辑

var row = $('#tg').treegrid('getSelected');
editingId = row.id
$('#tg').treegrid('beginEdit', editingId);

结束编辑

$('#tg').treegrid('beginEdit', editingId);

取消编辑

$('#tg').treegrid('cancelEdit', editingId);

复杂的表格

合并列,合并行

<table title="Reports using TreeGrid" class="easyui-treegrid" style="width:700px;height:250px"
		data-options="
			url: 'treegrid_data3.json',
			method: 'get',
			rownumbers: true,
			showFooter: true,
			idField: 'id',
			treeField: 'region'
		">
	<thead frozen="true">
		<tr>
			<th field="region" width="200">Region</th>
		</tr>
	</thead>
	<thead>
		<tr>
			<th colspan="4">2009</th>
			<th colspan="4">2010</th>
		</tr>
		<tr>
			<th field="f1" width="60" align="right">1st qrt.</th>
			<th field="f2" width="60" align="right">2st qrt.</th>
			<th field="f3" width="60" align="right">3st qrt.</th>
			<th field="f4" width="60" align="right">4st qrt.</th>
			<th field="f5" width="60" align="right">1st qrt.</th>
			<th field="f6" width="60" align="right">2st qrt.</th>
			<th field="f7" width="60" align="right">3st qrt.</th>
			<th field="f8" width="60" align="right">4st qrt.</th>
		</tr>
	</thead>
</table>

参考文档

http://www.jeasyui.com/documentation/index.php#

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/154887.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • ubuntu设置中文输入法_ubuntu如何使用中文输入法

    ubuntu设置中文输入法_ubuntu如何使用中文输入法找到设置 选择区域和语言点击ManageInstalledLanguagees,提示安装的话安装即可4.点击图示内容。5.将Chinese(simplified)勾选上右键点击住,将汉语拖到第一位重启Ubuntu6.在输入源中点击+号,选中里面的汉语,再选中里面的汉语(IntelligentPinyin),添加即可,并将其移动到第一位。在输入源中点击+号,…

    2022年9月26日
    6
  • 如何划分音节并区分重读和非重读单词_重读音节符号怎么标

    如何划分音节并区分重读和非重读单词_重读音节符号怎么标这里涉及到了英语里的双音节和多音节的知识一、双音节单词的音节划分方法可归纳为“两分手.一归前或一归后”.1.“两分手”是指:当两个元音之间有两个辅音字母时,将两个辅音字母划分在前后两个音节里.具体

    2022年8月4日
    7
  • 数据分析常见分析模型

    数据分析常见分析模型可参考知乎https://www.zhihu.com/question/36360374做数据分析更多是在理解业务和商业的基础上去选择或建立自己想要的模型才能得出分析出有用的价值

    2022年5月9日
    29
  • 理解条件概率_如何理解条件概率

    理解条件概率_如何理解条件概率版权声明:本文为博主原创文章,未经博主同意不得转载。https://blog.csdn.net/sheismylife/article/details/25009545网上看了一些解释。认为这个比

    2022年8月1日
    7
  • java string类型转换成int类型(string怎么强转int)

    String是引用类型,int是基本类型,所以两者的转换并不是基本类型间的转换,这也是该问题提出的意义所在,SUN公司提供了相应的类库供编程人员直接使用

    2022年4月15日
    286
  • 智慧物业小程序_智慧小区物业管理小程序搭建开发有现成案例

    智慧物业小程序_智慧小区物业管理小程序搭建开发有现成案例智慧小区物业管理小程序搭建开发有现成案例【欢迎手机致电:沈经理153.1556.5651微信同步】你我您社区团购模式平台开发,你我您社区商城购物便捷取货模式开发,你我您社区app小程序系统开发,支持二次开发维信小程序的出现,为传统企业发展提供了新的平台。通过维信小程序,传统企业可以实现推广、营销等一系列功能,让企业获得新的动力和机遇。一、你我您社区小程序是什么?1.限时商品抢购,团购价下单2.到…

    2022年10月18日
    3

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号