I'm currently working with JQuery plugin for struts2. I would like to know how to reload a JQuery grid without loosing the current scroll position and collapse rows.
In order to reload the data in the grid I'm using the following javascript code:
var timerID = setInterval("RefreshGridData()", 5000);
function RefreshGridData() {
$("#griditems").trigger("reloadGrid");
}
The jsp of the grid is the following:
<s:url id="itemsurl" action="getItemsJson.action" />
<s:url id="subitemsurl" action="getSubItemsJson.action" />
<sjg:grid id="griditems" caption="Items and Subitems" dataType="json"
href="%{itemsurl}" pager="false" viewrecords="true" height="400"
gridModel="gridModel" rowNum="-1" sortable="true">
<sjg:grid id="gridsubitems" subGridUrl="%{subitemsurl}"
gridModel="gridModel" rowNum="-1">
<sjg:gridColumn name="subcol1" index="subcol1" title="SubColumn 1"
width="120" />
<sjg:gridColumn name="subcol2" index="subcol2" title="SubColumn 2"
align="left" width="120" />
</sjg:grid>
<sjg:gridColumn name="col1" index="col1" title="Column 1" sortable="true"
width="80"/>
<sjg:gridColumn name="col2" index="col2"
title="Column 2" sortable="true" />
<sjg:gridColumn name="col3" index="col3" title="Column 3"
sortable="true" />
</sjg:grid>
Any comments on how to implement this are welcome.
Thanks in advance.