Adhikar Patil

Adhikar Patil

  • NA
  • 481
  • 128.9k

How to reload jqgrid after deleting the data

Feb 19 2019 2:45 AM
Hello,
 
I have jqgrid with data. I have an problem like after deleting the record in jqgrid is not loading with refresh data.
 
Below is my Code. Please give me the solution
  1. onclickSubmit: function (response, postdata){  
  2. var rowData = jQuery(this).jqGrid('getRowData', postdata);  
  3. $.ajax({  
  4. type: "POST",  
  5. url: "/Element/DeleteElementData",  
  6. data: { Id: rowData.ID },  
  7. error: function (xhr, status, error) {  
  8. toastr.error('An error occured while deleting the record...'); },  
  9. success: function (response) {  
  10. if (response.IsSuccess) {  
  11. toastr.success(response.Message);  
  12. ReloadGrid(); } else {  
  13. toastr.error(response.Message); } }  
  14. });  
  15. function ReloadGrid() {  
  16. // $("#ElementsGrid").setGridParam({ url: '/Element/GetElementDefectData' }).trigger('reloadGrid', { fromServer: true });  
  17. $("#ElementsGrid").jqGrid("setGridParam", { datatype: "json" })  
  18. .trigger("reloadGrid", [{ current: true }]); }  

Answers (5)