Implement delete and edit operations in jqgrid

I have the following JQgrid implementation

colModel: [ { name: 'NameEn', index: 'NameEn', width: 100, align: 'left' }, { name: 'Desc', index: 'Desc', width: 100, align: 'left' }, { name: 'ID', index: 'ID', width: 100, align: 'left', hidden:true } ], caption: "Management", gridview: true, rownumbers: true, rownumWidth: 40, scroll: 0, rowNum: 100, sortname: 'ID', pager: '#pager', sortorder: "asc", viewrecords: true, autowidth: true, width: '100%', height: '100%', jsonReader: { root: "GridData", page: "CurrentPage", total: "TotalPages", records: "TotalRecords", repeatitems: false, id: "00" } }; SectorGrid.prototype.SetupGrid = function (selector) { jQuery(selector).html('<table id="grid"></table><div id="pager"></div>'); var grid = jQuery("#grid").jqGrid(this.gridConfiguration); jQuery("#grid").navGrid('#pager',{edit:false,add:false,del:true,search:false}) }; 

I want to add the delete function, delete the web service call from the URL http: //localhost/services.svc/sector (id ), and the service will just take the identifier and it will handle everything by itself, I would also like to edit the data using differnt url http: //localhost/services.svc/sector and this gets a json object with the same information as above. I really tried to configure it, but it will not work, can someone help me with this, this is an assistant professor if you used the delete option in jqgrid or custom buttons, but I do not want to use the editurl property.

please provide a complete example of how to implement this, continue with my code above

UPDATED : recreation method

 [WebInvoke(UriTemplate = "Sector({iD})/", Method = "DELETE", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)] [OperationContract] bool DeleteSector(string iD) 

early

+1
source share
1 answer

Try using navGrid in the form

 jQuery("#grid").jqGrid('navGrid', '#pager', {edit: false, add: false, search: false}, {}, {}, { // Delete parameters ajaxDelOptions: { contentType: "application/json" }, mtype: "DELETE", serializeDelData: function () { return ""; // don't send and body for the HTTP DELETE }, onclickSubmit: function (params, postdata) { params.url = '/Sector(' + encodeURIComponent(postdata) + ')/'; } }); 
+2
source

All Articles