I have two grids one that is my data grid and the other my totals grid. As I do my updates or deletes to my data grid I would like to force the totals grid to do a refresh so that as data is changed my totals grid goes back to the server and gets the new totals.
How do I do this?
Answer: Use WARP Pannel.
There is another way if you want to use java script client code.
Use the AfterXmlHttpResponseProcessed Event of the Editing grid to send a refresh command via invokeXmlHttpRequest to the other grid. When you update or delete a record client code will detect this and send a command to refresh the totals grid. This is all AJAX activity so the web page does not refresh, just the controls.
<script id="igClientScript" type="text/javascript">
var oGridTotals;
oGridTotals = igtbl_getGridById(gridName);
}
var oGrid = igtbl_getGridById(gridName);
// type is eReqType. Possible values:
// 0 = none, 1= ChildRows, 2=MoreRows, 3=Sort, 4=UpdateCell
// 5= AddNewRow, 6=DeleteRow, 7=UpdateRow, 8=Custom
// 9=Page, 10=Scroll (ps..there are more)
if ((type == 4) or (type == 6) or (type == 7))
{
</script>
Im assuming from a performance standpoint this is the better way to go?
Usually, depending on the number of controls you need to refresh and the specific reasons to trigger a refresh.
Performance in Web Apps is all about trips to and from the server, how much information goes back and forth. If I am assuming correctly, the need is merely to have one grid refresh when the other is updated. Using the WARP panel will refresh all information contained in the warp panel, whenever anthing that causes a postback occurs. Using the client script will refresh only the target grid and only for the reason you want it too, you can be more precise, thus less data back and forth.
The WARP panel makes it easier for the layout since the warp panel requires no programming to accomplish the refresh, however, everything inside the panel or linked to it (see documentation on this) is refreshed regardless of the reason for postback, which may be more than you need.
The only thing I put inside of the warp pannel was the totals grid.
Sounds like you are all set.