<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增删改查前段代码的更多相关文章

  1. SpringMVC+SpringJdbc+SQLServer+EasyUI增删改查

    前言 前天用SpringJdbc连接了一把SQLServer,早上起来用SpringMVC+SpringJdbc+EasUI写了个增删改查的demo,主要是熟悉下SpringMVC相关知识点,如vie ...

  2. HBase1.2.0增删改查Scala代码实现

    增删改查工具类 class HbaseUtils { /** * 获取管理员对象 * * @param conf 对hbase client配置一些参数 * @return 返回hbase的HBase ...

  3. JDBC连接mysql增删改查整体代码

    第一种比较low:用了statment,没有用preparedstatement.另外,插入时,不灵活,不能调用参数,但是如果直接给函数形参的话就会被SQL注入攻击,所以,最好在sql语句中使用?代表 ...

  4. easyui增删改查

    easyui的crud(dialog,datagrid.form讲解)1.datagrid布局2.dialog布局3.form布局4.通用的JsonBaseDao增删改方法5.dao层6.web层7. ...

  5. 连接SQLServer的增删改查方法代码

    在Visual C++中用ADO进行数据库编程 1. 生成应用程序框架并初始化OLE/COM库环境 创建一个标准的MFC AppWizard(exe)应用程序CADOConnection,然后在使用A ...

  6. mysql数据库的连接以及增删改查Java代码实现(转载)

    每天叫醒自己的不是闹钟,而是梦想 数据库: create table t1(id int primary key not null auto_increment,name varchar(32),pa ...

  7. EF6 简单增删改查示例代码

    示例一: private DbContext _dbContext; public DbContext CurrentContext { get { if (_dbContext == null) { ...

  8. js的动态表格的增删改查完整代码

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  9. Android 系统API实现数据库的增删改查和SQLite3工具的使用

    在<Android SQL语句实现数据库的增删改查>中介绍了使用sql语句来实现数据库的增删改查操作,本文介绍Android 系统API实现数据库的增删改查和SQLite3工具的使用. 系 ...

随机推荐

  1. web 页面上纯js实现按钮倒计数功能(实时计时器也可以)

    需求构思:本功能想实现的是,一个按钮在页面载入就显示提醒续费,,,倒数60秒后,完成提醒功能,可以按另外一个页面跳转到主页. 参考网上的大神,实现如下:Button2倒数,Button3跳转,在页面上 ...

  2. mail语法

    在Linux系统下mail命令的用法 在Linux系统下mail命令的测试 1. 最简单的一个例子: mail -s test admin@aispider.com 这条命令的结果是发一封标题为tes ...

  3. mount: mounting proc on /proc failed: Device or resource busy

    /********************************************************************** * mount: mounting proc on /p ...

  4. tcpkill,干掉tcp连接

    场景 当我们需要在不重启服务的情况下断开某一个TCP长连接时,tcpkill工具就非常有用.比如我们要测试某个长连接断开后程序自动重连的情况. tcpkill安装 这个连接的作者改了一下tcpkill ...

  5. httpd和tomcat之间的区别和联系?

    difference between Apache HTTP server and Tomcat? In general, the Apache HTTP server is just a plain ...

  6. less的入门教程

    CSS的短板 作为前端学习者的我们 或多或少都要学些 CSS ,它作为前端开发的三大基石之一,时刻引领着 Web 的发展潮向. 而 CSS 作为一门标记性语言,可能 给初学者第一印象 就是简单易懂,毫 ...

  7. js调用app启动页

    第一步:添加js $(function () { var ua = window.navigator.userAgent.toLowerCase(); //微信 if(ua.match(/MicroM ...

  8. macbook 下hadoop伪分布式安装

    1 准备原材料 1.1  jdk 1.8.0_171(事先安装并配置环境变量HAVA_HOME,PATH) 1.2 Hadoop 2.8.3 2 免密登陆配置(否则安装过程需要不断输入密码) 2.1 ...

  9. 2018.4.27 java容器

    一.容器的概念 在Java当中,如果有一个类专门用来存放其它类的对象,这个类就叫做容器,或者就叫做集合,集合就是将若干性质相同或相近的类对象组合在一起而形成的一个整体 二.容器与数组的关系 之所以需要 ...

  10. 编译Linux-4.15.1内核时遇到:“error : openssl/bio.h :No such file or folder”

    如题: scripts/extract-cert.c::: fatal error: openssl/bio.h: No such file or directory compilation term ...