Posts

Showing posts with the label PrimeFaces

Making a RemoteCommand programmatically

What is RemoteCommand You can find a usage for PrimeFaces RemoteCommand on client side here . RemoteCommand is an implementation of UICommand in PrimeFaces library. With RemoteCommand you can call a bean method as an ajax call from a client side component callback, for example onChange, onHide, onClick etc. And in the following it is shown that how you can generate a RemoteCommand and join it to a component programmatically. Required libraries import java.util.Map; import javax.el.MethodExpression; import javax.faces.application.Application; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.event.MethodExpressionActionListener; import org.primefaces.component.outputlabel.OutputLabel; import org.primefaces.component.outputpanel.OutputPanel; import org.primefaces.component.remotecommand.RemoteCommand; import org.primefaces.component.selectcheckboxmenu.SelectCheckboxMenu; RemoteCommand example FacesContext ...

Programmatically add ajax behavior to SelectCheckboxMenu

How to add an ajax behavior to PrimeFaces SelectCheckboxMenu programmatically You can find a simple example for SelectCheckboxMenu here  and see how it looks like Import required libraries import javax.el.MethodExpression; import javax.el.ValueExpression; import javax.faces.application.Application; import javax.faces.component.UIComponent; import javax.faces.component.UIViewRoot; import javax.faces.component.html.HtmlPanelGrid; import javax.faces.context.FacesContext; import javax.faces.event.AjaxBehaviorEvent; import javax.faces.event.BehaviorEvent; import org.primefaces.component.behavior.ajax.AjaxBehavior; import org.primefaces.component.behavior.ajax.AjaxBehaviorListenerImpl; import org.primefaces.component.message.Message; import org.primefaces.component.outputlabel.OutputLabel; import org.primefaces.component.outputpanel.OutputPanel; import org.primefaces.component.selectcheckboxmenu.SelectCheckboxMenu; import org.primefaces.event.ToggleSelectEvent; ...