135
PrimeFaces SelectCheckboxMenu
It is used to choose multiple items displayed in an overlay. We can create it by using <p:selectCheckboxMenu> component. It displays options in an overlay. It provides attribute that are tabled below.
SelectCheckboxMenu Attributes
Attribute | Default value | Return type | Description |
---|---|---|---|
id | null | String | It is an unique identifier of the component. |
rendered | true | Boolean | It is used to render the specify component. |
binding | null | Object | It binds an expression that maps to a server side UIComponent instance in a backing bean. |
value | null | Object | It is used to set value of the component. |
converter | null | Converter/String | It is used to define a converter for the component. |
required | false | Boolean | It is used to mark component as required. |
requiredMessage | null | String | It is used to set a message to be displayed when required field validation fails. |
style | null | String | It is used to set inline style of the component. |
onShow | null | String | It is a method that executes when overlay is displayed. |
onHide | null | String | It is a method that executes when overlay is hidden. |
multiple | false | Boolean | It is used to set selected itemds as multiple labels. |
Ajax Behavior Events
SelectCeckboxMenu provides an Ajax event in addition to common dom events like change, selectCheckboxMenu.
Event | Listener Parameter | Executed |
---|---|---|
toggleSelect | org.primefaces.event.ToggleSelectEvent | When toggle all checkbox changes. |
Example
Here, in the following example, we are implementing <p:selectCheckboxMenu> component. This example contains the following files.
JSF File
// calendar.xhtml
ManagedBean
// CheckboxMenu.java
This JSF application produces the following output.
Output:
We can see that it allows us to select multiple items from the menu.
Next TopicPrimeFaces Editor