$(document).ready(function() {
$('#jpgCustomers').jqGrid({
//url from wich data should be requested
url: '@Url.Action("Customers")',
//type of data
datatype: 'json',
//url access method type
mtype: 'POST',
serializeRowData: function(postData) {
$.blockUI({message: ("#working")});
return postData;
},
//columns model
//columns names
colNames: ['No.', 'Name', 'FullName', 'Description', 'Enabled', 'Email Address', 'Phone', 'Pager', 'Fax', 'Comments', ' '],
colModel: [
//displayed Columns
{ name: 'Number', index: 'Number', align: 'center', width: 40, editable: false, search: false },
{ name: 'LogonName', index: 'LogonName', align: 'left', width: 80, editable: true, search: true, stype: 'text', editrules: { required: true } },
{ name: 'FullName', index: 'FullName', align: 'left', width: 200, editable: true, search: true, stype: 'text', editrules: { required: true } },
{ name: 'Description', index: 'Description', align: 'left', width: 300, editable: true, search: true, stype: 'text' },
{ name: 'Enabled', index: 'Enabled', align: 'center', width: 80, editable: true, formatter: SFTPEnabledFormatter, unformat: SFTPEnabledUnformatter, edittype: 'select', editoptions: { value: '-2:Inherited;0:Disabled;1:Enabled' }, search: true, stype: 'select', searchoptions: { value: "-1:All;-2:Inherited;1:Enabled;0:Disabled" } },
//Hidden Columns
{ width: 60, name: 'Email', index: 'Email', hidden: true, editable: true, editrules: { required: true, edithidden: true }, editype: 'email' },
{ width: 60, name: 'Phone', index: 'Phone', hidden: true, editable: true, editrules: { required: false, edithidden: true, number: true, minValue: 0 }, editype: 'text' },
{ width: 60, name: 'Pager', index: 'Pager', hidden: true, editable: true, editrules: { required: false, edithidden: true, number: true, minValue: 0 }, editype: 'text' },
{ width: 60, name: 'Fax', index: 'Fax', hidden: true, editable: true, editrules: { required: false, edithidden: true, number: true, minValue: 0 }, editype: 'text' },
{ width: 120, name: 'Comments', index: 'Comments', align: 'left', hidden: true, editable: true, editrules: { required: false, edithidden: true }, edittype: 'textarea', editoptions: { rows: '3', cols: '60' } },
//Action column
{
name: 'myac',
width: 80,
fixed: true,
sortable: false,
resize: false,
editable: false,
search: false,
formatter: 'actions',
formatoptions: {
onSuccess: function(response) {
debugger;
$.unblockUI();
var jsonResponse = $.parseJSON(response.responseText);
if (jsonResponse.State != 'Success') {
return [false, jsonResponse.ResponseMessage];
} else {
return [true];
} },
onError :function(rowid, response, textStatus) {
debugger;
$.unblockUI();
},
keys: true,
delOptions: {
url: encodeURI('@Url.Action("DeleteCustomer")'),
onclickSubmit: function(params, posdata) {
$.blockUI({message: ("#working")});
},
afterSubmit: function(response, postData) {
$.unblockUI();
var jsonResponse = $.parseJSON(response.responseText);
if (jsonResponse.State != 'Success') {
return [false, jsonResponse.ResponseMessage];
} else {
return [true];
}
},
beforeShowForm: function(form) {
var dlgDiv = $("#delmod" + jpgCustomers.id);
CenterDialog(dlgDiv);
var sel_id = $("#DelData>td:nth-child(1)").text();
$("td.delmsg", form).html("Delete User <b>" + $("#jpgCustomers").jqGrid('getCell', sel_id, 'LogonName') + "</b>?");
}
}
}
}
],
reloadAfterSubmit: true,
//pager for grid
pager: $('#jpgpCustomers'),
//number of rows per page
rowNum: @(Model.RowsInCustomerGrid),
//initial sorting column
sortname: 'FullName',
//initial sorting direction
sortorder: 'asc',
//we want to display total records count
viewrecords: true,
//grid height
height: '100%',
//where to go on submit of edit/add
editurl: encodeURI('@Url.Action("EditCustomer")'),
//subgrid
});
});

jqueryGrid 内置的onclickSubmit afterSubmit的更多相关文章

  1. TODO:Laravel 内置简单登录

    TODO:Laravel 内置简单登录 1. 激活Laravel的Auth系统Laravel 利用 PHP 的新特性 trait 内置了非常完善好用的简单用户登录注册功能,适合一些不需要复杂用户权限管 ...

  2. python黑魔法 -- 内置方法使用

    很多pythonic的代码都会用到内置方法,根据自己的经验,罗列一下自己知道的内置方法. __getitem__ __setitem__ __delitem__ 这三个方法是字典类的内置方法,分别对应 ...

  3. Entity Framework 6 Recipes 2nd Edition(11-12)译 -> 定义内置函数

    11-12. 定义内置函数 问题 想要定义一个在eSQL 和LINQ 查询里使用的内置函数. 解决方案 我们要在数据库中使用IsNull 函数,但是EF没有为eSQL 或LINQ发布这个函数. 假设我 ...

  4. 在DevExpress程序中使用内置的图标构建美观的界面元素

    在我们一般的程序中,为一般的界面元素添加一定的图标展示,有助于提升界面的整体的美观.结合排版布局,以及固定场景的图标,往往给用户非常好的直观感受:统一.美观.易理解.因此在一般的程序界面中,都尽量在略 ...

  5. Java第三方数据库连接池库-DBCP-C3P0-Tomcat内置连接池

    连接池原理 数据库连接池的基本思想就是为数据库连接建立一个“缓冲池”.预先在缓冲池中放入一定数量的连接,当需要建立数据库连接时,只需从“缓冲池”中取出一个,使用完毕之后再放回去.我们可以通过设定连接池 ...

  6. java web学习总结(二十五) -------------------JSP中的九个内置对象

    一.JSP运行原理 每个JSP 页面在第一次被访问时,WEB容器都会把请求交给JSP引擎(即一个Java程序)去处理.JSP引擎先将JSP翻译成一个_jspServlet(实质上也是一个servlet ...

  7. javaScript的内置对象

    javaScript 有11种内置对象: Array . String .Date .Math . Boolean .Number . Function .Global .Error . RegExp ...

  8. ASP.NET的六大内置对象

    ASP.NET 六大内置对象(System.Web.UI.Page类): 1.Response 2.Request 3.Server 4.Application 5.Session 6.Cooki R ...

  9. Java 性能分析工具 , 第 2 部分:Java 内置监控工具

    引言 本文为 Java 性能分析工具系列文章第二篇,第一篇:操作系统工具.在本文中将介绍如何使用 Java 内置监控工具更加深入的了解 Java 应用程序和 JVM 本身.在 JDK 中有许多内置的工 ...

随机推荐

  1. PHP trim()函数的一些用法

    string trim ( string $str [, string $charlist ] ) - 去除字符串首尾处的空白字符(或者其他字符) trim()函数当第二个参数为空时,默认去掉空格.制 ...

  2. ps怎么给文字描边

    在设计的时候,单一的文字,往往对人没有多少的吸引力,这就需要我们在文字上加一些文字特效,比如说外发光,描边,投影,等等.在这里我们详细的介绍一下文字的输入,和文字描边的怎么增加,删除的经验.(这些方法 ...

  3. Picker组件封装

    在开发APP的过程中,我们可能会遇上软件中需要有很多下拉选择样式,就像之前我做的那个<房贷计算器>一样,有很多下拉选择,如果没有将Picker封装起来共用是很麻烦的. 安装插件 在Reac ...

  4. Maven错误Failed to read artifact descriptor for xxx:jar 和 missing artifact maven dependency

    可参考:http://stackoverflow.com/questions/6111408/maven2-missing-artifact-but-jars-are-in-place http:// ...

  5. 10 Best TV Series Based On Hacking And Technology

    Technology is rapidly becoming the key point in human lives. Here we have discussed top TV shows whi ...

  6. public animal this[int index]|索引器的使用

    学习如何使用索引器,索引器的使用是public 类型 this[int index]{get{};set{}} ,访问通过类的实例(对象)加[i], 例如animal[i],就像访问数组一样,其实就是 ...

  7. CI框架程序--本地调试之后部署新浪SAE

    前几天给朋友写了个简单的网站, 想想还是部署到服务器上让朋友看一下效果! 用CI框架写的,有个SAE新浪云的账号,可以用!就部署到上面去了!途中遇到了一些问题!一一解决了! 在这里分享一下 供遇到这些 ...

  8. Handoff使用指南 - 理论篇

    Handoff简介 Handoff是iOS 8 和 OS X v10.10中引入的功能,可以让同一个用户在多台设备间传递项目.In iOS 9 and OS X v10.11 支持了Spotlight ...

  9. Cocos2d-JS中的文本菜单

    文本菜单是菜单项只能显示文本,文本菜单类包括了cc.MenuItemLabel.cc.MenuItemFont和cc.MenuItemAtlasFont.cc.MenuItemLabel是个抽象类,具 ...

  10. c#高级编程第七版 学习笔记 第一章 .NET体系结构

    第一章      .NET体系结构 本章内容: 编译和运行面向.NET的代码 Microsoft中间语言(Microsoft Intermediate Language,MSIL或简称IL)的优点 值 ...