Reputation: 51
I'm using inline editing and I have a custom delete button on the inline nav panel that deletes the row from the database. I have a grid refresh var (that I got from one of Oleg's responses on here) that works fine for add's and edit's but I can't get it to work on my delete button. Here's the code for the add/edit functions which refreshes fine:
jQuery("#list").jqGrid("navGrid", '#pager', {add:false, edit:false, del:false, search:false, refresh:false});
jQuery("#list").jqGrid("inlineNav",'#pager',{add:true, addicon:"ui-icon-plus", del:false, reloadAfterSubmit:true, edit:true, editicon:"ui-icon-pencil", search:false, addParams: {position: "last", addRowParams: editOptions}, editParams: editOptions});
Here's the code for my delete button which doesn't work:
jQuery("#list").jqGrid("navButtonAdd",'#pager',{buttonicon:'ui-icon-trash', onClickButton:function(){$.get('delgridrow.php?id='+detailid);}, reloadAfterSubmit:false, afterSubmit: editOptions, caption:'', position:'last'});
And here's the var that I got from Oleg that works for the adds/edits:
var editOptions = {
keys: true,
successfunc: function () {
var $self = $(list);
setTimeout(function () {
$self.trigger("reloadGrid");
}, 50);
}
};
I've tried changing reloadAfterSubmit to true but that doesn't help. Any suggestions would be appreciated.
Upvotes: 3
Views: 1866
Reputation: 26258
Try this:
$('#grid').trigger( 'reloadGrid' );
on successful deletion. It will refresh the jqgrid
Upvotes: 4