Grouping selectCheckboxMenu items with header using lambdaj

Posted: March 8, 2013 in web

xthml

 <p:selectCheckboxMenu styleClass="utilityFilter" value="#{quoteBean.selectedUtilities}"
 label="#{quoteBean.utilityLabel}"
 filter="true">
 <f:selectItems value="#{quoteBean.utilityWithState}" />
 <p:ajax listener="#{quoteBean.utilityListener()}" update="@form" />
 </p:selectCheckboxMenu>

Backing Bean


Group<Quote> groups = group(quotes, by(on(Quote.class).getStateName()),
 by(on(Quote.class).getUtilityName()));
 for (String state : groups.keySet()) {
 utilityWithState.add(new SelectItem(state, state, null, true));
 for (String utility : groups.findGroup(state).keySet()) {
 utilityWithState.add(new SelectItem(utility, utility));
 }
 }

js

$(window).load(function(){
 formatHeader();
});

function formatHeader(){
 var id = $('.utilityFilter').attr('id').substr(11,7);
 var disabledStateHeaders = $('div[id$="'+id+'_panel"] ul .ui-state-disabled');
 disabledStateHeaders.closest('li').css('background','#E36F1E');
 disabledStateHeaders.closest('li').find('label').css({
 'padding-left':'3px',
 'font-size':'16px',
 'color':'#fff',
 'font-weight':'Bold'});
 disabledStateHeaders.parent().css('display','none');
};

template

 <p:ajaxStatus onstart="dialog_loading.show()"
 onsuccess="dialog_loading.hide()" oncomplete="formatHeader();" />
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s