SelectManyButton
SelectManyButton is an input component to select options using buttons instead of checkboxes.
Source
<h:form>
<p:selectManyButton value="#{formBean.selectedOptions}">
<f:selectItem itemLabel="B" itemValue="Bold" />
<f:selectItem itemLabel="I" itemValue="Italic" />
<f:selectItem itemLabel="U" itemValue="Underline" />
</p:selectManyButton>
<p:separator style="margin-bottom:20px"/>
<p:commandButton value="Submit" oncomplete="dlg.show()" update="display" />
<p:dialog header="Selected Values" modal="true" showEffect="fade" hideEffect="fade" widgetVar="dlg">
<p:dataList id="display" value="#{formBean.selectedOptions}" var="option">
#{option}
</p:dataList>
</p:dialog>
</h:form>
package org.primefaces.examples.view;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FormBean implements Serializable {
private List<String> selectedOptions;
public List<String> getSelectedOptions() {
return selectedOptions;
}
public void setSelectedOptions(List<String> selectedOptions) {
this.selectedOptions = selectedOptions;
}
}
