easyui增删改查前段代码
<script>
var url;
//添加用户窗体
function newUser()
{
$('#dlg').dialog('open').dialog('setTitle', '学生信息添加');
$('#fm').form('clear');
url = '/Students/Add';
}
//编辑
function editUser()
{
var row = $('#dg').datagrid('getSelected');
if (row) {
$('#dlg').dialog('open').dialog('setTitle', '修改学生信息');
$('#fm').form('load', row);
url = '/Students/Edit/' + row.StuId;
}
}
//提交方法
function saveUser() {
$('#fm').form('submit', {
url: url,
onSubmit: function () {
return $(this).form('validate');
},
success: function (data) {
if (data.Result==false) {
$.messager.show({
title: 'Error',
msg: data.Message
});
} else {
$('#dlg').dialog('close'); // close the dialog
$('#dg').datagrid('reload'); // reload the user data
}
}
});
}
function InitGrid()
{
$("#dg").datagrid({
url: '/Students/StudentRead',
title: '学生列表',
toolbar: '#toolbar',
rownumbers: true,
fitcolumns: true,
singleselect: true });
} </script> <table id="dg" title="My Users" class="easyui-datagrid" style="width:550px;height:250px"
url="/Students/StudentRead"
toolbar="#toolbar"
rownumbers="true" fitcolumns="true" singleselect="true">
<thead>
<tr>
<th field="StuName" width="">学生姓名</th>
<th field="Age" width="">年龄</th>
<th field="Sex" width="">性别</th>
<th field="CreateTime" width="">创建时间</th>
</tr>
</thead>
</table> <div id="toolbar">
<a href="#" class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="newUser()">New User</a>
<a href="#" class="easyui-linkbutton" iconcls="icon-edit" plain="true" onclick="editUser()">Edit User</a>
<a href="#" class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="destroyUser()">Remove User</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">
<div class="fitem">
<label>StuName:</label>
<input name="StuName" class="easyui-textbox">
</div>
<div class="fitem">
<label>Age:</label>
<input name="Age" class="easyui-textbox">
</div>
<input type="hidden" name="StuId"/>
</form>
</div>
<div id="dlg-buttons">
<a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="saveUser()">Save</a>
<a href="#" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">Cancel</a>
</div>
easyui增删改查前段代码的更多相关文章
- SpringMVC+SpringJdbc+SQLServer+EasyUI增删改查
前言 前天用SpringJdbc连接了一把SQLServer,早上起来用SpringMVC+SpringJdbc+EasUI写了个增删改查的demo,主要是熟悉下SpringMVC相关知识点,如vie ...
- HBase1.2.0增删改查Scala代码实现
增删改查工具类 class HbaseUtils { /** * 获取管理员对象 * * @param conf 对hbase client配置一些参数 * @return 返回hbase的HBase ...
- JDBC连接mysql增删改查整体代码
第一种比较low:用了statment,没有用preparedstatement.另外,插入时,不灵活,不能调用参数,但是如果直接给函数形参的话就会被SQL注入攻击,所以,最好在sql语句中使用?代表 ...
- easyui增删改查
easyui的crud(dialog,datagrid.form讲解)1.datagrid布局2.dialog布局3.form布局4.通用的JsonBaseDao增删改方法5.dao层6.web层7. ...
- 连接SQLServer的增删改查方法代码
在Visual C++中用ADO进行数据库编程 1. 生成应用程序框架并初始化OLE/COM库环境 创建一个标准的MFC AppWizard(exe)应用程序CADOConnection,然后在使用A ...
- mysql数据库的连接以及增删改查Java代码实现(转载)
每天叫醒自己的不是闹钟,而是梦想 数据库: create table t1(id int primary key not null auto_increment,name varchar(32),pa ...
- EF6 简单增删改查示例代码
示例一: private DbContext _dbContext; public DbContext CurrentContext { get { if (_dbContext == null) { ...
- js的动态表格的增删改查完整代码
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- Android 系统API实现数据库的增删改查和SQLite3工具的使用
在<Android SQL语句实现数据库的增删改查>中介绍了使用sql语句来实现数据库的增删改查操作,本文介绍Android 系统API实现数据库的增删改查和SQLite3工具的使用. 系 ...
随机推荐
- day063 form 和modelform组件
注册功能: (写一个简单的注册功能,要求用户名长度不得小于6位.) 普通方式写注册功能 views视图下: def register(request): error_msg=' ' if reque ...
- tensoFlow之DNN文本分类
TensorFlow文本分类: 亲测可用:https://blog.csdn.net/u012052268/article/details/77862202 简单实例:https://www.leip ...
- Android开发 ---xml构建选项菜单、上下文菜单(长按显示菜单)、发通知、发送下载通知
1.activity_main.xml 描述: 定义了一个TextView和三个按钮 <?xml version="1.0" encoding="utf-8&quo ...
- oracle 链接
<properties> <!--配置Hibernate方言 --> <property name="hibernate.dialect" value ...
- AFNetworking 3.0简单数据请求get&post
/** *get请求方法 */ - (void)AFNGetUrl { AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; ...
- python发送邮箱的小项目
import smtplibfrom email.mime.text import MIMEText receiver = input('输入接受者邮箱\n')subject = input('输入标 ...
- 2019-04-15-day032-多进程介绍
内容回顾 基于原生socket的udp协议实现将client端发送过来的消息放到字典中 字典的key是所有客户端的地址,value是一个列表 io :输入输出, 输入到内存,向内存输入 从内存中向外( ...
- 剑指Offer 50. 数组中重复的数字 (数组)
题目描述 在一个长度为n的数组里的所有数字都在0到n-1的范围内. 数组中某些数字是重复的,但不知道有几个数字是重复的.也不知道每个数字重复几次.请找出数组中任意一个重复的数字. 例如,如果输入长度为 ...
- Combining Lexical and Grammatical Features to Improve Readability Measures for First and Second Language Texts.-paper
http://www.aclweb.org/anthology/N07-1058 Volume:Human Language Technologies 2007: The Conference of ...
- Unreal Engine 4 C++ UCLASS构造函数易出错分析
Unreal Engine 4 C UCLASS构造函数易出错分析 GENERATED_BODY GENERATED_UCLASS_BODY 在Unreal Engine 4的任意类中通常会见到两个宏 ...