好的,所以我正在尝试向我的网格添加删除/更新/添加功能。当前的问题是当我在删除确认弹出窗口中单击提交时,Url 有我不想要的额外参数。
例如:http: //xxx.xxx/product/DeleteProduct ?productId=&oper=del&id=2000
我希望它看起来像:http: //xxx.xxx/product/DeleteProduct ?productId=2000
如何删除“&oper=del&id=”。
谢谢你的帮助。代码如下。
<div id="tabs-2">
<script type="text/javascript">
$(document).ready(function () {
jQuery("#productTable").jqGrid({
url: 'http://xxx.xxx/product/GetAllProducts',
mtype: 'GET',
datatype: 'json',
height: 250,
width: 900,
pgbuttons: false, pgtext: null, viewrecords: false, rowList: [],
rowNum:-1,
pager: '#productPager',
viewrecords: true,
colNames: ['Id', 'Active', 'Description', 'Features', 'Name', 'Specification', 'ThumbNail', 'View Image', 'Solution Id', 'Search Type', 'Section', 'Section Search'],
colModel: [
{ name: 'Id', index: 'Id', width: 60, sortable: false,align:"center", editable: false },
{ name: 'active', index: 'active', width: 90, sortable: false, align:"center", editable: true },
{ name: 'description', index: 'description', width: 90, sortable: false, editable: true },
{ name: 'features', index: 'features', width: 100, sortable: false, editable: true },
{ name: 'name', index: 'name', width: 80, sortable: false, editable: true },
{ name: 'specification', index: 'specification', width: 100, height:40, sortable: false, editable: true, edittype:'textarea',editoptions: {
rows:'3',cols:'20', dataInit: function (domElem) {
$(domElem).addClass("editable");
}}},
{ name: 'thumbNail', index: 'thumbNail', width: 100, sortable: false, editable: true },
{ name: 'viewImage', index: 'viewImage', width: 100, sortable: false, editable: true },
{ name: 'SolutionId', index: 'SolutionId', width: 100, sortable: false, align:"center", editable: true },
{ name: 'searchType', index: 'searchType', width: 100, sortable: false, align:"center", editable: true },
{ name: 'section', index: 'section', width: 100, sortable: false, align:"center", editable: true },
{ name: 'sectionSearch', index: 'sectionSearch', width: 100, sortable: false, align:"center", editable: true },
],
jsonReader: {
root: 'resultObject',
id: 'Id',
repeatitems: false,
page: function (obj) { return 1; },
total: function (obj) { return 1; },
records: function (obj) { return obj.resultObject.length }
},
});
jQuery("#productTable").jqGrid('navGrid', '#productPager', { edit: false, add: false, del: true, search: false, refresh: false },
// Edit options
{},
// Add options
{},
//del options
{
mtype: 'GET',
url: 'http://xxx.xxx/product/DeleteProduct?productId=',
onclickSubmit: function (postdata) {
alert('in onclickSubmit: postdata=' + postdata);
return {};
},
reloadAfterSubmit: true,
closeOnEscape: true,
bottominfo: "Fields marked with (*) are required."
}
);
});
</script>
<table id="productTable"></table>
<div id="productPager"></div>
</div>