jQuery("#list2").jqGrid(
{
url: 'data/JSONData.json',
datatype :"json",// "local",
colNames : [ 'Inv No', 'Date', 'Client', 'Amount', 'Tax','Total', 'Notes' ],
colModel : [ //jqGrid每一列的配置信息。包括名字,索引,宽度,对齐方式.....
{name : 'id',index : 'id',width : 55,editable:true,editoptions:{readonly:true,size:25}},
{name : 'invdate',index : 'invdate',width : 90,editable:true,editoptions:{size:25}},
{name : 'name',index : 'name asc, invdate',width : 100,editable:true,editoptions:{size:25}},
{name : 'amount',index : 'amount',width : 80,align : "right",editable:true,editoptions:{size:25}},
{name : 'tax',index : 'tax',width : 80,align : "right",editable:true,editoptions:{size:25}},
{name : 'total',index : 'total',width : 80,align : "right",editable:true,editoptions:{size:25}},
{name : 'note',index : 'note',width : 150,sortable : false,editable:true,editoptions:{size:25}}
],
loadonce: true,
rowNum : 10,//一页显示多少条
rowList : [ 10, 20, 30 ],//可供用户选择一页显示多少条
pager : '#pager2',//表格页脚的占位符(一般是div)的id
sortname : 'id',//初始化的时候排序的字段
sortorder : "desc",//排序方式,可选desc,asc
mtype : "post",
editurl: "/edit.ashx",
closeAfterAdd: true,
closeAfterEdit: true,
caption: "Andy JSON Example",
errorTextFormat: function (data) {
return 'Error: ' + data.responseText
},
afterSubmit: function () {
$(this).jqGrid("setGridParam", { datatype: 'json' });
return [true];
}
});
后端返回的是Json结果,
context.Response.Write("{"status":"success"}");
为什么编辑窗口还是新增窗口都是不能关闭,请大家指点,谢谢!