O'Reilly logo

PrimeFaces Cookbook by Mert Çalışkan, Oleg Varaksin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Displaying checkboxes in SelectCheckboxMenu

SelectCheckboxMenu is a multiselect input component based on checkboxes in an overlay menu. Although it is an input component, it is presented to users as a menu so that it makes sense to handle SelectCheckboxMenu in this chapter.

In this recipe, we will implement a simple and an advanced SelectCheckboxMenu component. In the advanced case, we will learn about the built-in filtering feature. Selected items should be shown in a dialog when submitting.

How to do it...

Usage of SelectCheckboxMenu is the same as for SelectManyCheckbox. Checkbox items can be attached via several f:selectItem tags or one f:selectItems tag. In the following simple example, we will use f:selectItems to display colors:

<p:selectCheckboxMenu ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required