I am using struts 2.3.7, struts2-jquery-grid-plugin-3.5.0 and hibernate 3.6. I want to reload the jqgrid after an ajax call made.
I have an jDialog box which have three buttons,After clicking the buttons,We hove to perform some operations such as an Ajax call after that I have to reload the jqgrid how to achieve that.
my jDialog
<sj:dialog
id="mybuttondialog"
buttons="{
'Approove':function() { approoveButton(); },
'Cancel':function() { cancelButton(); },
'Deny':function() { denyButton(); }
}"
autoOpen="false"
modal="true"
title="Assign Issues"
width="375"
resizable="false"
draggable="true"
closeTopics="closeThisDialog"
>
My jqGrid is as
<div id="targetDivToRefresh">
<sjg:grid
id="gridtable"
caption="Issue-Summary"
dataType="json"
href="%{remoteurl}"
pager="true"
gridModel="gridModel"
rowList="10,15,20"
rowNum="15"
rownumbers="true"
reloadTopics="reloadGrid"
>
<sjg:gridColumn name="issue_id" id="issueId" index="id" title="Issue-ID" formatter="integer" sortable="false"/>
<sjg:gridColumn name="issue_description" index="id" title="Issue-Details" sortable="false"/>
<sjg:gridColumn name="issue_raised_date" index="date" title="Issue-Date" formatter="date" sortable="false"/>
<sjg:gridColumn name="issue_id" index="issues" title="Action" sortable="false" formatter="formatLink"/>
<sjg:gridColumn name="assigned" index="assigned" title="Assigned To" sortable="false"/>
</sjg:grid>
</div>
After clicking the the column "Acton" the jDialog box opened where I have to click on any buttons i.e. Approove,Deny Buttons to perform some operations. After Completion of the ajax call I have to reload the jqgrid. I am using customFormatter as
function formatLink(cellvalue, options, rowObject) {
var issueId=rowObject.issue_id;
return "<a href='#' onClick='javascript:openDialog("+issueId+")'>" + issueId+ "</a>";
}
function openDialog(issue) {
global_id=issue;
$("#mybuttondialog").dialog().text('Your are going to assign Issue-Id:' + issue);
$("#mybuttondialog").dialog('open');
}
However I have tried something like this to reload the grid:
$("#gridtable").trigger("reloadGrid"); // where #gridtable is my jqGrid idName
Please help me out, I am using jqgrid first time.
Edited Section
Actually the ajax call is in demo phase, however the code is as follows.
function approoveButton()
{
$("#mybuttondialog").load("<s:property value='issueTrackerUrl'/>?id="+global_id);
}
Here issueTrackerUrl is an action which made an ajax call successfully. And here I reload the jqgrid
function reload()
{
$("#gridtable").trigger("reloadGrid");
}