jsf 2 - Multi checkbox with grouping in dropdown using primefaces JSF -
i need have dropdown list has grouped , should able multi select using checkbox using primefaces. can me out?
there no primefaces component ready use in case. cloesest ones selectonemenu (dropdown list grouping, single selection without checkbox) , selectcheckboxmenu (dropdown list multi selection , checkbox, without grouping).
i not see chance in customizing selectonemenu suit needs. extending selectcheckboxmenurenderer support selectitemgroup may option selectcheckboxmenu.
the idea behind traverse full hierarchy, render selectitemgroups non selectable options , leaf selectitems normal options. concrete implementation you.
if hierarchy flat another simple approach can be, mimic groups disabled selectitems selectcheckboxmenu. visually not best result should fulfill needs. example <f:selectitems />
value can be
list<selectitem> options = arrays.aslist( new selectitem("group1", "group1", "group1", true), new selectitem("option1", "option1", "option1", false), new selectitem("option2", "option2", "option2", false), new selectitem("group2", "group2", "group2", true), new selectitem("option3", "option3", "option3", false), new selectitem("option4", "option4", "option4", false) );
Comments
Post a Comment