在孙宇老师讲得Easyui第10讲完后,基本的增删该查做出来了,但是编辑存在一个问题;行内样式编辑修改,如果当用户没有修改数据,孙宇老师讲得时候直接return,这样做是不合理的;第二次再使用右键编辑时就是用不了右键编辑功能了;因此我将代码修改如下:
if (inserted.length < 1 && updated.length < 1) {
editRow = undefined;
//回滚
$admin_user_dategrid.datagrid('rejectChanges');
} else {
var url = '';
if (inserted.length > 0) {
console.info('rowData');
console.info(rowData);
url = 'user/user_create.action';
}
if (updated.length > 0) {
url = 'user/user_update.action';
}
$
.ajax({
url : url,
data : rowData,
dataType : 'json',
success : function(r) {
if (r && r.success) {
$admin_user_dategrid
.datagrid('acceptChanges');
$.messager.show({
msg : r.msg,
title : '成功'
});
$admin_user_dategrid
.datagrid('reload');
} else {
//回滚
$admin_user_dategrid
.datagrid('rejectChanges');
$.messager.alert('错误',
r.msg, 'error');
}
editRow = undefined;
$admin_user_dategrid
.datagrid('unselectAll');
}
});
}
未修改之前的源码: if (inserted.length < 1 && updated.length < 1) {
editRow = undefined;
datagrid.datagrid('unselectAll');
return;
} var url = '';
if (inserted.length > 0) {
url = 'userAction!add.action';
}
if (updated.length > 0) {
url = 'userAction!edit.action';
} $.ajax({
url : url,
data : rowData,
dataType : 'json',
success : function(r) {
if (r.success) {
datagrid.datagrid('acceptChanges');
$.messager.show({
msg : r.msg,
title : '成功'
});
editRow = undefined;
datagrid.datagrid('reload');
} else {
/*datagrid.datagrid('rejectChanges');*/
datagrid.datagrid('beginEdit', editRow);
$.messager.alert('错误', r.msg, 'error');
}
datagrid.datagrid('unselectAll');
}
}); http://bbs.jeasyuicn.com/forum.php?mod=viewthread&tid=5547&extra=page%3D3

对easyUI中课堂源码编辑改进建议的更多相关文章

  1. ckeditor源码编辑模式,添加style、javascript内容丢失的解决

    我使用ckeditor 我在编辑的使用源码编辑,保存内容包含javascript.style标签的时候,数据库中有javascript.style标签 , 输入到页面也可以执行,但是我再次编辑的时候就 ...

  2. 【原】Spark中Client源码分析(二)

    继续前一篇的内容.前一篇内容为: Spark中Client源码分析(一)http://www.cnblogs.com/yourarebest/p/5313006.html DriverClient中的 ...

  3. 【原】Spark中Master源码分析(二)

    继续上一篇的内容.上一篇的内容为: Spark中Master源码分析(一) http://www.cnblogs.com/yourarebest/p/5312965.html 4.receive方法, ...

  4. 【原】 Spark中Worker源码分析(二)

    继续前一篇的内容.前一篇内容为: Spark中Worker源码分析(一)http://www.cnblogs.com/yourarebest/p/5300202.html 4.receive方法, r ...

  5. Django缓存机制--rest_framework中节流源码使用的就是django提供的缓存api

    一.配置缓存   https://www.jb51.net/article/124434.htm 二.缓存全站.页面.局部   三.自我控制的简单缓存API API 接口为:django.core.c ...

  6. 深入理解 Node.js 中 EventEmitter源码分析(3.0.0版本)

    events模块对外提供了一个 EventEmitter 对象,即:events.EventEmitter. EventEmitter 是NodeJS的核心模块events中的类,用于对NodeJS中 ...

  7. php中foreach源码分析(编译原理)

    php中foreach源码分析(编译原理) 一.总结 编译原理(lex and yacc)的知识 二.php中foreach源码分析 foreach是PHP中很常用的一个用作数组循环的控制语句.因为它 ...

  8. vue打包时,assets目录 和static目录下文件的处理区别(nodeModule中插件源码修改后,打包后的文件应放在static目录)

    为了回答这个问题,我们首先需要了解Webpack如何处理静态资产.在 *.vue 组件中,所有模板和CSS都会被 vue-html-loader 及 css-loader 解析,并查找资源URL.例如 ...

  9. 从 sourcemap 中获取源码

    使用 paazmaya/shuji: Reverse engineering JavaScript and CSS sources from sourcemaps 可以从 sourcemap 中获取源 ...

随机推荐

  1. HDU 1087 Super Jumping! Jumping! Jumping!(动态规划)

    Super Jumping! Jumping! Jumping! Problem Description Nowadays, a kind of chess game called “Super Ju ...

  2. CSU-ACM2016暑假集训训练2-DFS(C - Network Saboteur)

    C - Network Saboteur Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu ...

  3. Wix: Using Patch Creation Properties - Minor Update

    Based on the project created in Wix: Using Patch Creation Properties - Small Update, Following chang ...

  4. OCI_ERROE - errcode[1591],errmsg[ORA-01591:

    CEASYDAO: 错误码[1591],错误信息[Error - OCI_ERROE - errcode[1591],errmsg[ORA-01591: lock held by in-doubt d ...

  5. IE10访问Apache2.4卡死的问题

    windows环境下,使用IE10访问Apache2.4时,服务器经常卡死 找到EnableSendfile on,在下一行添加如下配置解决: AcceptFilter http none Accep ...

  6. iOS数据库操作流程

    SQLite最新的版本是3.0,使用之前应该先导入libsqlite3.0.dylib 1.导入流程 2.iOS中操作数据库的流程 打开数据库 准备SQL数据库 执行SQL数据库 语句完结 关闭数据库 ...

  7. jQuery1.8以上,ajaxSend,ajaxStart等一系列事件要绑定在document上才有效果

    jQuery1.8以上,ajaxSend,ajaxStart等一系列事件要绑定在document上才有效果

  8. c#基础知识对比(面向对象)

    private,protected,public和internal private:是完全私有的,只有本类自己能用[好比自己的老婆,只有你自己可以调用,其他谁都不可以] protected:可被外界看 ...

  9. 转 修改oracle用户密码永不过期

      1.查看用户的proifle是哪个,一般是default: sql>SELECT username,PROFILE FROM dba_users; 2.查看指定概要文件(如default)的 ...

  10. 构造SEH来实现跳转-转载

    下面的代码出自CSDN Delphi版的一高人(kiboisme 蓝色光芒) procedure ExceptProc{ExceptionRecord,SEH,Context,DispatcherCo ...