This content has been marked as final.
Show 3 replies
-
1. Re: how to provide ajax support for custom components in Richfaces 4.5.5
michpetrov Jun 3, 2015 5:42 AM (in response to anitham)Hi,
in RichFaces 4.x a4j:ajax is a ClientBehavior (not a UIComponent), adding one is pretty easy:
AjaxBehavior ajax = new AjaxBehavior(); ajax.setRender("output"); component.addClientBehavior("keydown", ajax);
-
2. Re: how to provide ajax support for custom components in Richfaces 4.5.5
anitham Jun 3, 2015 7:34 AM (in response to michpetrov)Hi,
Thanks for the reply. Could you please clarify on this.
Is component.addClientBehavior("Keydown",ajax) is same as setting the event "Keydown" like the below syntax.
ajax.setEvent("Keydown")
Also could you please how to add actionlistener in ajaxBehavior.
-
3. Re: how to provide ajax support for custom components in Richfaces 4.5.5
michpetrov Jun 3, 2015 8:18 AM (in response to anitham)Yes, that is the same, it's from ClientBehaviorHolder.addClientBehavior().
Listener can be added like this:
FacesContext fc = FacesContext.getCurrentInstance(); MethodExpression expr = fc.getApplication().getExpressionFactory() .createMethodExpression(fc.getELContext(), "#{bean.action}", null, new Class[] {AjaxBehaviorEvent.class}); MethodExpressionAjaxBehaviorListener meabl = new MethodExpressionAjaxBehaviorListener(expr); ajax.addAjaxBehaviorListener(meabl);
You have to specify the AjaxBehaviorEvent even if your method takes no parameters.