1 Reply Latest reply on Jan 14, 2010 4:05 PM by allforjava.allforjava.aol.in

    Object Required? COnversation related?

    allforjava.allforjava.aol.in

      Hi,


      I need to list all the records, each with an column having associated values/records/checkbox. The checkbox toggle neeed to be persisted without reloading the page/view. The view is rendered however the actionLitener is not invoked, with the error at status bar of IE, 'Object Required'. I doubt whether any conversation/scope related issue. Any alternate way to accomplish this.


      </rich:column>
           <h:selectManyCheckbox id="idMC_sheets">
                <s:selectItems  value="#{sheetsList.fetchSheetsFor(_works.checklists)}"
                          var="sheet" itemValue="#{sheet}" label="#{sheet.id}"/>
                     <a4j:support event="onclick" actionListener="#{sheetsList.toggleSheets}"/>
                <s:convertEntity/>
           </h:selectManyCheckbox>
      </rich:column>
      



      import javax.faces.event.ActionEvent;
      
      @Name("sheetsList")
      @Scope(ScopeType.CONVERSATION)
      public class SheetsList extends EntityQuery<Sheets> {
      
           private static final String[] RESTRICTIONS = { 
                "sheets.checklists = #{sheetsList.sheets.checklists}",  
           };
           
           .
           .
           .
           
           @Begin(join=true)
           public List<Sheets> fetchSheetsFor(Checklists checklists){
                if(checklists == null){
                     System.out.println("fetchSheetsFor(): No restriction");
                }
                getSheets().setChecklists(checklists);
                setMaxResults(null);
                     List<Sheets> list = getResultList(); 
                setMaxResults(25);
                return list;
           }
           
           public void toggleSheets(ActionEvent event){
                System.out.println("Sheet Toggled!");
                System.out.println(event);
           }
      }
      


      Parent component used to display main view with associated checkboxes.


      @Name("worksList")
      @Scope(ScopeType.CONVERSATION)
      public class WorksList extends EntityQuery<Works> {
      .
      .
      .
      }
      

        • 1. Re: Object Required? COnversation related?
          allforjava.allforjava.aol.in

          Ahhaaa! Missed h:form tag. For following snippet the ActionListener is invoked. However, how can I fetch the entity which is responsible for ActionEvent. Can I get it value/object/entity than need to be updated from ActionEvent object 'event'? How to do it?


          <h:form>
              <rich:dataTable id="worksList"
                          var="_works"
                        value="#{worksList.resultList}"
                     rendered="#{not empty worksList.resultList}">
          
                  <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 id="idMC_sheets">
                    <s:selectItems  value="#{_works.checklists.sheets}" 
                                        var="sheet" itemValue="#{sheet}" label="#{sheet.id}"/>
                                             
                    <s:convertEntity/>                    
               </h:selectManyCheckbox>
               <a4j:support event="onclick" attachTo="idMC_sheets"  
                               actionListener="#{sheetsHome.toggleSheets}"/>
                  </rich:column>
              </rich:dataTable>
          </h:form>