<script type="text/javascript">
$("#EmpGrid").jqGrid({
url: "/Employee/GetRecords",
datatype: "json",
jsonReader: {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
rownumbers: true,
Id: "0"
},
editurl: "/Employee/EditEmployeeDetails",
colNames: ["Actions", "Name", "City", "Address"],
colModel: [
{
name: 'Id', index: 'Id', key: true, formatter: 'actions',
formatoptions: {
keys: true,
editformbutton: true,
editOptions: { closeAfterEdit: true, reloadAfterSubmit: true },
}
},
{ name: "Name", key: true, editable: true, index: "Name", sortable: true, width: 300, search: true, stype: 'text', formatter: 'showlink', formatoptions: { baseLinkUrl: 'javascript:', showAction: "EditEmployee('", addParam: "');" } },
@*{ name: "Name", editable: true, index: "Name", sortable: true, width: 300, search: true, stype: 'text', formatter: 'showlink', formatoptions: { baseLinkUrl: '@Url.Action("GetEmployeeDetails", "Employee")', idName:'id'} },*@
{ name: "City", index: "City", sortable: true, width: 300, search: true, stype: 'text', editable: true },
{ name: "Address", index: "Address", sortable: true, width: 300, search: true, stype: 'text', editable: true }
],
rowList: [10, 20, 30, 40, 50],
pager: "#pager",
aftersavefunc: function () {
},
gridview: true,
autoencode: true,
gridview: true,
rownumbers: true,
height: "auto",
loadonce: true,
caption: "List of Employees",
ignoreCase: true
}).jqGrid("filterToolbar", { searchOnEnter: false, stringResult: true, defaultSearch: "cn" });
我的代码工作正常。由于我是Jqgrid的新手,除了在列中提供的编辑选项之外不知道很多事情,我能够在表单中编辑记录,并且在提交closeafteredit
工作正常,我也从服务器获得编辑数据但{{{ 1}}无效。
我需要帮助。请问有谁有想法?请帮帮我。