-
1. Re: Proper use of modal panel for confirmantion & success me
ilya_shaikovsky May 15, 2007 1:18 PM (in response to ckadam)Main page:
<rich:modalPanel id="_panel"> <a4j:include viewId="/pages/greeting.xhtml"></a4j:include> </rich:modalPanel> <h:form id="_form"> <rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="5" rowKeyVar="row" id="table" > <h:column> ... </h:column> <h:column> <a4j:commandButton oncomplete="javascript:Richfaces.showModalPanel('_panel')" value="Delete" ajaxSingle="true"> <a4j:actionparam value="#{row}" assignTo="#{capitalsBean.deletedRow}" name="row"/> </a4j:commandButton> </h:column> </rich:dataTable> </h:form>
first include (popup):<h:form> <h:outputText value="Sure to delete?"></h:outputText> <a4j:commandLink action="#{capitalsBean.delete}" value="Delete"> </a4j:commandLink> <h:outputLink value="#" onclick="javascript:Richfaces.hideModalPanel('_panel')"> <h:outputText value="Close"></h:outputText> </h:outputLink> </h:form>
Second include (if needed):<h:form onsubmit="javascript:Richfaces.hideModalPanel('_panel')"> <a4j:commandLink value="Hide" reRender="table"></a4j:commandLink> </h:form>
bean:public String delete() { //String sid=FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("row"); System.out.println(getDeletedRow()); int intid = Integer.parseInt(getDeletedRow()); capitals.remove(intid); return "greeting1"; }
Looks like your use case. -
2. Re: Proper use of modal panel for confirmantion & success me
ckadam May 15, 2007 4:46 PM (in response to ckadam)Thanks for the response .
I understand how you are showing the first confirmation dialog and updating Backing bean prior to that. However from your example, it was not very clear as in :
1. Where is the second include actually included ? (in main page or in the greetings dialog )
2. How does the second modal panel invoked. ? Based on the delete action on first modal panel, its simply calling action on the backing bean. Does this action have some navigation rules, which cause first modal panel to close and display second modal panel ? -
3. Re: Proper use of modal panel for confirmantion & success me
ilya_shaikovsky May 16, 2007 6:02 AM (in response to ckadam)There is navigation occurs as far as I used ajax action component inside the a4j:include which is returns navigation outcome.
So there will be navigation inside the include after delete link activated or closure if close pressed.