techlead
techlead

Reputation: 779

jqgrid - delete row refreshes the page

I have the following code for the delete row:

HTML

<div class="Delete">Delete</div>

Jquery

$("div.Delete").live("click", function(){
   toDelete = $("#myjqgrid").jqGrid('getGridParam','selrow');
   $("#myjqgrid").jqGrid('delGridRow',toDelete);
});

So, when I click on the "Delete" div:

How can I make delete row work on the client side?

Upvotes: 1

Views: 4588

Answers (2)

Oleg
Oleg

Reputation: 221997

I think that you should just use reloadAfterSubmit: false property of delGridRow method:

$("#myjqgrid").jqGrid('delGridRow', toDelete, {reloadAfterSubmit: false});

If you in general prefer such behavior on the deleting of the rows by delGridRow method you can change the default parameters with

$.extend($.jgrid.del, {reloadAfterSubmit: false});

If you include the code somewhere at the beginning all calls of delGridRow will use reloadAfterSubmit: false by default. By the way it's the standard setting which I mostly use.

Upvotes: 2

Ali Youhanaei
Ali Youhanaei

Reputation: 384

if your problem just in get confirm from client, use confirm in your code:

$("div.Delete").live("click", function(){
   if (confirm("Are You Sure?")) {
      toDelete = $("#myjqgrid").jqGrid('getGridParam','selrow');
      $("#myjqgrid").jqGrid('delGridRow',toDelete);
   }
});

Upvotes: 0

Related Questions