DataGrid( 数据表格) 组件[5]
本节课重点了解 EasyUI 中 DataGrid(数据表格)组件的使用方法,这个组件依赖于
Panel(面板)、Resizeable(调整大小)、LinkButton(按钮)、Pageination(分页)组件。
一. 新增功能





columns : [[
{
field : 'user',
title : '帐号',
sortable : true,
width : 100,
editor : {
type : 'validatebox',
options : {
required : true,
},
},
},
{
field : 'email',
title : '邮件',
sortable : true,
width : 100,
editor : {
type : 'validatebox',
options : {
required : true,
validType: 'email',
},
},
},
{
field : 'date',
title : '创建时间',
sortable : true,
width : 100,
editor : {
type : 'datetimebox',
options : {
required : true,
},
},
},
]],
//扩展 dateTimeBox
$.extend($.fn.datagrid.defaults.editors, {
datetimebox : {
init: function(container, options){
var input = $('<input type="text">').appendTo(container);
options.editable = false;
input.datetimebox(options);
return input;
},
getValue: function(target){
return $(target).datetimebox('getValue');
},
setValue: function(target, value){
$(target).datetimebox('setValue', value);
},
resize: function(target, width){
$(target).datetimebox('resize', width);
},
destroy : function (target) {
$(target).datetimebox('destroy');
},
}
});
//实现添加方法
obj = {
editRow : false,
search : function () {
$('#box').datagrid('load', {
user : $.trim($('input[name="user"]').val()),
date_from : $('input[name="date_from"]').val(),
date_to : $('input[name="date_to"]').val(),
});
},
add : function () {
$('#save').show();
$('#redo').show();
if (!this.editRow) {
$('#box').datagrid('endEdit', this.editRow);
} else {
$('#box').datagrid('insertRow', {
index : 0,
row : {
//date : (new Date()).Format("yyyy-MM-dd hh:mm:ss"),
},
});
$('#box').datagrid('beginEdit', 0);
this.editRow = true;
}
},
save : function () {
$('#save,#redo').hide();
this.editRow = false;
//将新增的一行设置为结束编辑状态
$('#box').datagrid('endEdit', 0);
},
redo : function () {
$('#save,#redo').hide();
this.editRow = false;
$('#box').datagrid('rejectChanges');
},
};
onAfterEdit : function (rowIndex, rowData, changes) {
console.log(rowData)
},
L //HTML 部分
<div style="margin-bottom:5px">
<a href="#" class="easyui-linkbutton" iconCls="icon-add"
plain="true" onclick="obj.add();">添加</a>
<a href="#" class="easyui-linkbutton" iconCls="icon-edit"
plain="true">修改</a>
<a href="#" class="easyui-linkbutton" iconCls="icon-remove"
plain="true">删除</a>
<a href="#" class="easyui-linkbutton" iconCls="icon-save"
plain="true" style="display:none;" id="save" onclick="obj.save();">保存
</a>
<a href="#" class="easyui-linkbutton" iconCls="icon-redo"
plain="true" style="display:none;" id="redo" onclick="obj.redo();">取消编
辑</a>
</div>
DataGrid( 数据表格) 组件[5]的更多相关文章
- DataGrid( 数据表格) 组件[9]
本节课重点了解 EasyUI 中 DataGrid(数据表格)组件的使用方法,这个组件依赖于Panel(面板).Resizeable(调整大小).LinkButton(按钮).Pageination( ...
- DataGrid( 数据表格) 组件[8]
本节课重点了解 EasyUI 中 DataGrid(数据表格)组件的使用方法,这个组件依赖于Panel(面板).Resizeable(调整大小).LinkButton(按钮).Pageination( ...
- DataGrid( 数据表格) 组件[7]
本节课重点了解 EasyUI 中 DataGrid(数据表格)组件的使用方法,这个组件依赖于Panel(面板).Resizeable(调整大小).LinkButton(按钮).Pageination( ...
- DataGrid( 数据表格) 组件[6]
本节课重点了解 EasyUI 中 DataGrid(数据表格)组件的使用方法,这个组件依赖于Panel(面板).Resizeable(调整大小).LinkButton(按钮).Pageination( ...
- DataGrid( 数据表格) 组件[4]
本节课重点了解 EasyUI 中 DataGrid(数据表格)组件的使用方法,这个组件依赖于Panel(面板).Resizeable(调整大小).LinkButton(按钮).Pageination( ...
- DataGrid( 数据表格) 组件[3]
本节课重点了解 EasyUI 中 DataGrid(数据表格)组件的使用方法,这个组件依赖于Panel(面板).Resizeable(调整大小).LinkButton(按钮).Pageination( ...
- DataGrid( 数据表格) 组件[2]
本节课重点了解 EasyUI 中 DataGrid(数据表格)组件的使用方法,这个组件依赖于Panel(面板).Resizeable(调整大小).LinkButton(按钮).Pageination( ...
- DataGrid( 数据表格) 组件[1]
本节课重点了解 EasyUI 中 DataGrid(数据表格)组件的使用方法,这个组件依赖于Panel(面板).Resizeable(调整大小).LinkButton(按钮).Pageination( ...
- 第二百二十二节,jQuery EasyUI,DataGrid(数据表格)组件
jQuery EasyUI,DataGrid(数据表格)组件 学习要点: 1.加载方式 2.分页功能 本节课重点了解 EasyUI 中 DataGrid(数据表格)组件的使用方法,这个组件依赖于 Pa ...
随机推荐
- 使用CAEmitterLayer实现下雪效果
效果图: 代码部分: #import "ViewController.h" @interface ViewController () @end @implementation Vi ...
- 启动mySQL安装出现1067错误
可能几种的办法: 删除data目录下的ib_logfile0和ib_logfile1 查看my.ini文件中的dir设置 查看err文件,如果是temp出现错误文件,则添加temp文件的路径
- swing常用布局
1,FlowLayout 窗口的默认布局 设置窗口布局方法(下面不重复 setLayout(new FlowLayout()); 设置容器布局方法 比如容器 con1 con1.setLayout(n ...
- 限制窗口拉伸范围(二)——OnSizing
之前用的GetMinMaxInfo,在VS2015中会导致:Report模式的CListCtrl随窗口拉伸时,表头无法绘制超过原大小的区域.其他版本和控件未测试,而OnSizing没有这问题. 前一方 ...
- CSS的力量
CSS(Cascading Style Sheet)级联样式表,是一种美观网页设计的解决方案,也是W3C推荐的标准,他可以是我们的网页设计更灵活,更美观,使设计人员对内容的设计和样式的设计分离,使设计 ...
- 1.1HTML的基本概念
1.WWW有3个基本的组成部分,分别是URL(统一资源定位器),HTTP(超文本传输协议),HTML(本文本标记语言). 2.一个HTML文件是由一系列的元素和标签组成的,元素不区分大小写. 3.&l ...
- 【回忆1314】第一次用AngularJS
1.创建指令的4种方式(ECMA) var appModule = angular.module('app', []); appModule.directive('hello', function() ...
- asp.net 解决IE11下 From身份验证失效问题
指定如何将 Cookie 用于 Web 应用程序. <forms cookieless="UseCookies" name="test" loginUrl ...
- MMDrawerController 使用遇到的问题及定制
MMDrawerController 1,集成UIViewController * leftDrawer = [[UIViewController alloc] init]; UIViewContro ...
- web UI
Semantic不错的UI,代码非常详细