-
1. RF 4.x + commandLink + oncomplete from java
ilya_shaikovsky Mar 23, 2011 6:48 AM (in response to forn)#{rich:component('createEssencePanel')}.show() should not be set as string directly but prior evaluated. on the client it should be document.getElementById('clientId').component.show()
Use RichFunction.component function to get JS string. and add .show() to it.
-
2. RF 4.x + commandLink + oncomplete from java
forn Mar 23, 2011 9:52 AM (in response to ilya_shaikovsky)Ilya Shaikovsky wrote:
Use RichFunction.component function to get JS string. and add .show() to it.
Thanks for answer. Where can i found API for using RichFunction, or can you write simply code for my example, pls. -
3. Re: RF 4.x + commandLink + oncomplete from java
forn Mar 23, 2011 10:12 AM (in response to ilya_shaikovsky)When i try use this code:
UICommandLink utilLink = new UICommandLink(); utilLink.getAttributes().put("reRender", util.getReRender()); String strOnClick = util.getOnClick(); if ((strOnClick != null) && (!strOnClick.equals(""))) { String[] onClick = strOnClick.split("\\."); if (onClick.length == 2) { String componentId = onClick[0]; String operation = onClick[1]; String componentViewId = RichFunction.component(componentId); utilLink.setOncomplete(componentViewId + "." + operation); } }
componentViewId - always null.My JSF:
<h:form> <rich:panel> <rich:toolbar id="functionalToolBar" itemSeparator="grid" binding="#{toolBarManager.functionalToolBar}"/> <!-- rich:toolbar id="functionalToolBar" itemSeparator="grid" height="26px"> <rich:toolbarGroup> <c:forEach var="util" items="#{toolBarManager.utilsForFolderClass}"> <a4j:commandLink value="" oncomplete="${util.onClick}" execute="@this" reRender="#{util.reRender}" render="#{util.reRender}"> <h:graphicImage value="#{util.iconEnabled}" style="border:0;" alt="#{util.name}" title="#{util.name}" /> </a4j:commandLink> <h:outputText value="#{util.onClick}" /> </c:forEach> </rich:toolbarGroup> </rich:toolbar--> </rich:panel> </h:form> <h:form id="createEssenceForm"> <!-- Создание сущности --> <rich:popupPanel id="createEssencePanel" modal="true" moveable="true" autosized="true" onmaskclick="#{rich:component('createEssencePanel')}.hide()" domElementAttachment="parent"> <f:facet name="header"> <h:outputText value="Создание сущности:" /> </f:facet> <f:facet name="controls"> <h:outputLink value="Закрыть" onclick="#{rich:component('createEssencePanel')}.hide(); return false;">Закрыть</h:outputLink> </f:facet> </rich:popupPanel> </h:form>
-
4. Re: RF 4.x + commandLink + oncomplete from java
forn Mar 23, 2011 10:39 AM (in response to ilya_shaikovsky)document.getElementById('clientId').component.show()
document.getElementById('clientId').rf.component.show()
-
5. Re: RF 4.x + commandLink + oncomplete from java
ilya_shaikovsky Mar 24, 2011 5:20 AM (in response to forn)here is what I've tried:
public String getCallApi() {
String id=(String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("componentId");
String api=(String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("apiFunc");
return RichFunction.component(id) + "." + api + "()" + ";";
}
<h:form>
<a4j:commandButton oncomplete="#{userBean.callApi}">
<a4j:param name="componentId" value="popup"/>
<a4j:param name="apiFunc" value="show"/>
</a4j:commandButton>
<rich:popupPanel id="popup" modal="false" autosized="true"
works for me. Could add parameters easilly instead of just adding () and ; constantly.