Datatable Refresh after a popup (popup generated using serv
anandsaranath Apr 29, 2009 10:35 AMHi,
We have an existing application in which we generate a table using jsp. There are context menus attached to this jsp generated table. We are trying to come out with a new functionality where we are using Richfaces 3.3.0 to generate the table dynamically and attach context menu to it. All these works fine. I am hitting a roadblock when I use the context menu. On clicking on the context menu in the new jsf page, I will pop up an existing window which will have a jsp page. When the user interacts with this jsp page, I want a data table in the the new jsf page to be refreshed.
Since the pop up acts like a separate thread (the javascript used to pop up does a window.open(url) to open this new pop up), I am clueless as to how to make that jsp / servlet to refresh this new page. I am attaching the code snippets for the same.
Any help in this regard will be much appreciated. This is a very critical requirement for us. This is a showstopper for this.
Regards
Anand
After the saInteractWithJob.jsp closes, I want the data table "queueTable" in the queueJobs.xhtml refreshed.
---------------------------queueJobs.xhtml--------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
 xmlns:ui="http://java.sun.com/jsf/facelets"
 xmlns:h="http://java.sun.com/jsf/html"
 xmlns:f="http://java.sun.com/jsf/core"
 xmlns:a4j="http://richfaces.org/a4j"
 xmlns:rich="http://richfaces.org/rich">
<div align="center">
 <h:form>
 <a4j:loadScript src="../../javascript/saSov.js" />
 <rich:contextMenu attached="false" id="menu" submitMode="ajax">
 <rich:menuItem onclick="return interactWithJob('{queue}', '{jobId}', '{iType}');">
 <a4j:support event="oncomplete" actionListener="#{SOV_SpecificQueueBean.queryJobs}" reRender="queueTable"/>
 <h:outputText value="Interact with Job {jobId})"/>
 </rich:menuItem>
 <rich:menuItem actionListener="#{SOV_SpecificQueueBean.stopJob}" reRender="queueTable">
 <h:outputText value="Stop Job {jobId})" />
 </rich:menuItem>
 </rich:contextMenu>
 <rich:dataTable value="#{SOV_SpecificQueueBean.valueList}" var="row" width="100%" rows="#{SOV_SpecificQueueBean.maxRecords}"
 onRowMouseOver="this.style.backgroundColor='#F8F888'"
 onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
 id="queueTable" sortMode="multiple">
 <rich:columns id="#{row.data[index]}_#{index}" value="#{SOV_SpecificQueueBean.columns}" var="col" index="index"
 sortBy="#{row.data[index]}" sortOrder="#{col.ordering}">
 <f:facet name="header">
 <h:outputText value="#{col.name}" />
 </f:facet>
 <h:outputText value="#{row.data[index]}" />
 </rich:columns>
 <rich:componentControl for="menu" operation="show" event="onRowClick">
 <f:param value="#{row.jobReqDesc.jobId}" name="jobId" />
 <f:param value="#{row.jobReqDesc.interactionType}" name="iType" />
 <f:param value="#{row.jobReqDesc.queue}" name="queue" />
 </rich:componentControl>
 </rich:dataTable>
 </h:form>
</div>
</html>
--------------------------------------------
interactWithJob javascript --
function interactWithJob(queue, job, interactionType) {
 alert("I am inside interact");
 var winLink = "/activator/jsp/saInteractWithJob.jsp?queueName=" + queue + "&jobId=" + job + "&inter
actionType=" + interactionType;
 window.open(winLink,'interact','resizable=yes,status=yes,width=750,height=300,scrollbars=yes');
 return true;
}
------------------------------------