EasyUI简单CRUD
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="keywords" content="jquery,ui,easy,easyui,web" />
<meta name="description" content="easyui help you build your web page easily!" />
<title>短信管理</title>
<link href="../Scripts/easyui/themes/default/easyui.css" rel="stylesheet" />
<link href="../Scripts/easyui/themes/icon.css" rel="stylesheet" />
<link href="../Scripts/easyui/demo/demo.css" rel="stylesheet" />
<style type="text/css">
#fm {
margin: 0;
padding: 10px 30px;
}
.ftitle {
font-size: 14px;
font-weight: bold;
color: #666;
padding: 5px 0;
margin-bottom: 10px;
border-bottom: 1px solid #ccc;
}
.fitem {
margin-bottom: 5px;
}
.fitem label {
display: inline-block;
width: 80px;
}
</style>
<script type="text/javascript" src="../Scripts/easyui/jquery.min.js"></script>
<script type="text/javascript" src="../Scripts/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../Scripts/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
var url;
function newUser() {
$('#dlg').dialog('open').dialog('setTitle', '添加短信');
$('#fm').form('clear');
url = "/OnlineMonitoring/ashx/MSGMgr.ashx?type=insert";
}
function editUser() {
var row = $('#dg').datagrid('getSelected');
if (row) {
$('#dlg').dialog('open').dialog('setTitle', '编辑短信内容');
$('#fm').form('load', row);
url = "/OnlineMonitoring/ashx/MSGMgr.ashx?type=update";
} else {
parent.$.messager.alert('提示', '请选择一行', "info");
}
}
function saveUser() {
$('#fm').form('submit', {
url: url,
onSubmit: function () {
return $(this).form('validate');
},
success: function (result) {
var result = eval('(' + result + ')');
if (result.result) {
$('#dlg').dialog('close'); // close the dialog
$('#dg').datagrid('reload'); // reload the user data
} else {
$.messager.show({
title: '服务端错误',
msg: "添加失败"
});
}
}
});
}
function removeUser() {
var row = $('#dg').datagrid('getSelected');
if (row) {
parent.$.messager.confirm('操作提示', '你确定删除这条短信吗?', function (r) {
if (r) {
$.post("/OnlineMonitoring/ashx/MSGMgr.ashx?type=delete", { short_message_id: row.short_message_id }, function (result) {
if (result.result) {
$('#dg').datagrid('reload'); // reload the user data
} else {
$.messager.show({ // show error message
title: '服务端错误',
msg: "删除短信失败"
});
}
}, 'json');
}
});
}
}
</script>
</head>
<body class="easyui-layout">
<div data-options="region:'center',fit:true,border:false" style="height: 100%">
<table id="dg" title="短信管理" class="easyui-datagrid"
url="/OnlineMonitoring/ashx/MSGMgr.ashx?type=select"
toolbar="#toolbar" pagination="false"
rownumbers="true" fitcolumns="true" singleselect="true" fit="true" method="get">
<thead>
<tr>
<th field="short_message_content" width="50" align="center">短信内容</th>
<th field="short_message_time" width="50" align="center">短信创建时间</th>
<th field="short_message_state" width="50" align="center" formatter="messageFormater">短信状态</th>
</tr>
</thead>
</table>
</div>
<div id="toolbar">
<a href="#" class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="newUser()">添加</a>
<a href="#" class="easyui-linkbutton" iconcls="icon-edit" plain="true" onclick="editUser()">编辑</a>
<a href="#" class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="removeUser()">删除</a>
</div>
<div id="dlg" class="easyui-dialog" style="width: 400px; height: 280px; padding: 10px 20px"
closed="true" buttons="#dlg-buttons">
<div class="ftitle">短信信息</div>
<form id="fm" method="post" novalidate>
<input type="hidden" name="short_message_id" />
<div class="fitem">
<label>短信内容:</label>
<input name="short_message_content" class="easyui-validatebox" required="true">
</div>
</form>
</div>
<div id="dlg-buttons">
<a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="saveUser()">确认</a>
<a href="#" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">取消</a>
</div>
</body>
</html>
<style type="text/css">
.panel-title {
text-align: center;
font-size: 20px;
}
#sex {
width: 50px;
}
</style>
<script>
function messageFormater(val) {
if (val == 1) {
return "已发送";
} else {
return "未发送";
}
}
</script>
EasyUI简单CRUD的更多相关文章
- 使用Struts2和jQuery EasyUI实现简单CRUD系统(转载汇总)
使用Struts2和jQuery EasyUI实现简单CRUD系统(一)——从零开始,ajax与Servlet的交互 使用Struts2和jQuery EasyUI实现简单CRUD系统(二)——aja ...
- MongoDB简单CRUD场景
MongoDB简单CRUD命令操作 (1)新建数据库:use 数据库名 (2)显示所有数据库:show dbs; (3)新建集合(两种方式) 隐式创建:在创建集合的同时往集合里面添加数据---db. ...
- 使用Struts2和jQuery EasyUI实现简单CRUD系统(七)——数据分页处理
上篇完毕多选删除的功能之后,接下来就是做分页功能了.曾经的分页是一个麻烦的问题.并且数据量巨大的时候,直接把这些元素取出来显然速度较慢,所以取一定区间的数据还是高效的. watermark/2/tex ...
- 使用Struts2和jQuery EasyUI实现简单CRUD系统(五)——jsp,json,EasyUI的结合
这部分比較复杂,之前看过自己的同学开发一个选课系统的时候用到了JSON,可是一直不知道有什么用.写东西也没用到.所以没去学他.然后如今以这样的怀着好奇心,这是做什么用的,这是怎么用的.这是怎么结合的心 ...
- SSM——(二):easyUI的CRUD
1.在WebContent下新建admin目录,添加index.html(用来显示user表的CRUD): 总结: 1.datagrid接收的必须是json数据: 2.使用分页插件会自动向后台传递St ...
- SequoiaDB 系列之二 :SequoiaDB的简单CRUD操作
上一篇通过一系列的操作,终于把SequoiaDB的集群部署到单台机器上了. 建议去安装体验一下吧. 在整个环境的部署的体验来看,并没有MongoDB的部署简单,但是比MongoDB的部署要清晰.Mon ...
- easyui简单使用
easyui近期一直都比较流行,虽然它在效果上被extjs爆了,它的使用难度低,在IE6下表现不错,的确受到了广泛企业程序员的好评. 但是他的API说明还是比较简陋的,刚上手可能还需要摸索一下,为什么 ...
- Servlet实现简单CRUD
1.首先在数据库中建表 create database student create table stu( sno char(10), sna char(10), ) insert stu value ...
- Easyui简单布局
1.创建布局 创建布局只需要添加 'easyui-layout' class 到 <div> 标记或者 在整个页面创建布局,即<body class="easyui-lay ...
随机推荐
- 在k8s中的基本概念
在k8s中的基本概念 一.Pod1. podk8s下最重要也最基本的概念,由一个根容器Pause和许多用户业务容器组成,是容器的载体. 2. pod的yaml定义格式及字段 apiVersion: v ...
- SpringMVC响应Restful风格请求404
在学习Springmvc时,使用Restful风格的url,页面提示404错误.为找到原因,编写一个简单的Restful测试用例如下: jsp页面: <a href="user/tes ...
- 对象的序列化(Serialization)
一.什么是序列化 序列化表示将一个对象转换成可存储或可传输的状态,序列化后对象可以在网络上进行传输,也可以存储到本地.对象的寿命通常随着生成该对象的程序的终止而终止.有时候,可能需要将对象的状态保存下 ...
- 优秀运维人员20道必会iptables面试题(转载)
(一)企业面试口试题 1.详述iptales工作流程以及规则过滤顺序? 2.iptables有几个表以及每个表有几个链? 3.iptables的几个表以及每个表对应链的作用,对应企业应用场景? 4.画 ...
- Drupal的system_list()函数解析
system_list()函数的目的是根据传入的资源类型,返回一个数组列表: function system_list($type) { ... ... } 参数$type支持下面三种类型: boot ...
- Difference between End-to-end testing and System testing
www.guru99.com/end-to-end-testing.html
- Linux常用指令总结
概述 因为平时不是经常使用Linux系统,每次用到都需要重新温习一遍,这里对自己平时经常使用到的指令做个小结,方便后面直接查阅. 常用指令 登陆root指令 sudo su - 安装软件及卸载指令 d ...
- python selenium--常用函数1
新建实例driver = webdriver.Chrome() 1.通过标签属性Id查找元素 方法:find_element_by_id(element_id) 实例:driver.find_elem ...
- ftp客户端的创建
1.本段代码采用了 select I/O端口复用 2.含有三种功能:ls, 上传文件, 下载文件.这是拷贝别人的代码,自己添加了注释,随后会进行修改, 自己需要的功能:上传文件, 下载文件, (并 ...
- scut客户端心跳超时和客户端断开测试
1.断开的消息触发后,依然会触发超时 2.触发超时不会触发断开 3.超时会触发多次,断开只触发一次 超时不是很准确,好像有时候不会触发.如果要判断玩家是否下线,可以用最后一次心跳时间判断