SelectManyCheckbox within rich:column
allforjava Dec 27, 2009 5:45 AMDear Team,
The valueChangeLister (bean method) is not invoked when the checkbox value is toggles. Whatm'I missing?
Following are the code snippet.
<rich:column>
<f:facet name="header">
<ui:include src="/layout/sort.xhtml">
<ui:param name="entityList" value="#{worksList}"/>
<ui:param name="propertyLabel" value="Checklists"/>
<ui:param name="propertyPath" value="works.checklists.id"/>
</ui:include>
</f:facet>
<h:selectManyCheckbox value="#{worksList.selectedSheets}" valueChangeListener="#{worksList.updateChecklists}">
<f:selectItems value="#{_works.checklists.fetchSheetsAsItems()}" />
<s:convertEntity/>
</h:selectManyCheckbox>
</rich:column>
And used with Seam Components & JPA entities
@Name
("worksList")
public
class WorksList extends EntityQuery<Works> {
...
     public List<Sheets> getSelectedSheets() {  
          return selectedSheets;      }    
     public void setSelectedSheets(List<Sheets> selectedSheets) {  
          this.selectedSheets = selectedSheets;      }    
     public void updateChecklists(ValueChangeEvent event){           System.
out.println("ValueChanged:"+event);      } }   @Entity @   Table(name = "AC_CHECKLISTS", schema = "ADR") public                  private Set<Sheets> sheets = new HashSet<Sheets>(0); //  with getter+setter        ...        @Transient        public List<SelectItem> fetchSheetsAsItems(){           Set<Sheets> hsSheets = getSheets();             if(hsSheets == null){                System. out.println("Sheets are Empty ");                System. out.print("for '"+works.getNotes()+"' in "+works.getShifts().getDescription());                  return null;           }               items = new ArrayList<SelectItem>(hsSheets.size());           Time interval = new Time(30*60*1000);           Time from = works.getShifts().getTimeFrom();               for (Sheets sheets : hsSheets) {                SelectItem si = new SelectItem();                si.setValue(sheets);                  items.add(si);                from = new Time(from.getTime()+interval.getTime());           }             return items;      }   }