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 ...
随机推荐
- 算法笔记_070:BellmanFord算法简单介绍(Java)
目录 1 问题描述 2 解决方案 2.1 具体编码 1 问题描述 何为BellmanFord算法? BellmanFord算法功能:给定一个加权连通图,选取一个顶点,称为起点,求取起点到其它所有顶 ...
- selenium-Navigating
The first thing you’ll want to do with WebDriver is navigate to a link. The normal way to do this is ...
- Android自动化测试之MonkeyRunner录制和回放脚本
Android自动化测试之MonkeyRunner录制和回放脚本(十一) 分类: 自动化测试 Android自动化 2013-02-22 10:57 7346人阅读 评论(2) 收藏 举报 andro ...
- .NET Remoting 入门实例
1.创建服务端Class:ProxyServerRemoting using System; using System.Collections.Generic; using System.Text; ...
- xml布局内容总结(三)--Android
关于xml中经经常使用到边框及边框效果,在此进行一下总结. 3.border(边框及边框效果) (1)直角边框线 <LinearLayout android:layout_wid ...
- php漏洞修复 禁用函数
别人利用此PHP函数可以对系统进行相关操作 1.打开php.ini找到 ; http://php.net/disable-functions 2.修改添加内容如下 disable_functions ...
- IOS 拍照旋转修正
- (UIImage *)fixOrientation:(UIImage *)aImage { // No-op if the orientation is already correct if (a ...
- 探索Popupwindow-对话框风格的窗体(
Android中还是会经经常使用到Popupwindow.一种类似于对话框风格的窗体,当然类似于对话框风格也能够用Activity,能够參考:Android中使用Dialog风格弹出框的Activit ...
- linux下批量替换文件内容(转)
http://www.cnblogs.com/end/archive/2012/05/24/2517131.html 1.网络上现成的资料 格式: sed -i "s/查找字段/替换字段/g ...
- Oracle VM VirtualBox虚拟机导出教程
Oracle VM VirtualBox虚拟机导出教程 | 浏览:583 | 更新:2015-01-31 11:21 1 2 3 4 5 6 7 分步阅读 有时我们需要把Oracle VM Virtu ...