-
1. Re: dynamic create inputText in portlet.
shadowcreeper Aug 21, 2008 3:44 PM (in response to rusbob)<h:inputText value="#{bean.value}" onchange="updateBeanValue(this.value);"/> <a4j:jsFunction name="updateBeanValue" oncomplete="doCalculation();"> <a4j:actionparam name="beanValue" assignTo="#{bean.value}"/> </a4j:jsFunction> <!-- We have to split this up due to a bug in Facelets wrt actionListeners with actionparams --> <a4j:jsFunction name="doCalculation" actionListener="#{bean.actionToExecute}" reRender="componentToReRender"/>
-
2. Re: dynamic create inputText in portlet.
rusbob Aug 21, 2008 3:53 PM (in response to rusbob)I am create this component incode bean dynamical
-
3. Re: dynamic create inputText in portlet.
rusbob Aug 22, 2008 1:44 AM (in response to rusbob)This not work.
In bean code:
HtmlInputText key = new HtmlInputText();
key.setValue(param.getKey());
key.setOnchange("updateBeanValue(this.value);");
uic1.getChildren().add(key);
in xhtml :
<h:panelGrid id="lspar" columns="2" styleClass="resultGrid"
rowClasses="even-row, odd-row"
>
<a4j:jsFunction name="updateBeanValue" immediate="true" ajaxSingle="true" oncomplete="doCalculation();">
<a4j:actionparam name="beanValue" assignTo="#{links.tmpIn}"/>
</a4j:jsFunction>
<a4j:jsFunction name="doCalculation" immediate="true" ajaxSingle="true" actionListener="#{links.inputText}"/>
</h:panelGrid> -
4. Re: dynamic create inputText in portlet.
rusbob Aug 22, 2008 3:33 AM (in response to rusbob)Problem! I can not get id componenta from xhtml, but in jsp page i can get id componenta:
in xhtml:
<a4j:jsFunction name="updateBeanValue" immediate="true" ajaxSingle="true" oncomplete="doCalculation();">
<a4j:actionparam name="beanValue" assignTo="#{links.tmpIn}"/>
<a4j:actionparam name="compId" assignTo="#{links.tmpId}"/>
</a4j:jsFunction>
<a4j:jsFunction name="doCalculation" actionListener="#{links.inputText}" immediate="true" ajaxSingle="true" />
In bean
HtmlInputText key = new HtmlInputText();
key.setValue(param.getKey());
key.setOnchange("updateBeanValue(this.value,this.id);");
uic1.getChildren().add(key);
}
public void inputText(ActionEvent e){
log.info("***"+e.getComponent());
log.info("Val-----"+this.getTmpIn()); // real value from page
log.info(" ID-----"+this.getTmpId());// !!!!! Id is empty!!!!!
} -
5. Re: dynamic create inputText in portlet.
rusbob Aug 22, 2008 4:13 AM (in response to rusbob)Yes!!! I am solved problem!
in bean:
HtmlInputText key = new HtmlInputText();
key.setValue(param.getKey());
key.setOnchange("updateBeanValue(this.value,this.name);");
uic1.getChildren().add(key);
public void inputText(ActionEvent e) {
String ids = this.getTmpId();
ids = ids.substring(ids.lastIndexOf(":"));
((HtmlInputText)FacesContext.getCurrentInstance().getViewRoot().findComponent("main"+ids)).setValue(this.getTmpIn());
}
in xhtml:
<a4j:jsFunction name="updateBeanValue" immediate="true" ajaxSingle="true" oncomplete="doCalculation();">
<a4j:actionparam name="beanValue" assignTo="#{links.tmpIn}"/>
<a4j:actionparam name="compId" assignTo="#{links.tmpId}"/>
</a4j:jsFunction>
<a4j:jsFunction name="doCalculation" actionListener="#{links.inputText}" immediate="true" ajaxSingle="true" />