3 Replies Latest reply on Aug 24, 2010 10:22 AM by sai burgula

    rich:dataTable row selection with column dropdown menu

    sai burgula Novice
      I have a rich:dataTable where in one of the columns is a drop down menu. 

      <rich:dataTable id="stdAdvisorResTab"   value="#{adminSearch.studentAdvisorList}"
               var="student" rows="25" sortMode="single"
               onRowMouseOver="this.style.backgroundColor='#FFFFAA'"
                onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
                                                                                                                                <rich:column>
                                                                            <f:facet name="header">
                                                                                 <h:outputText value="Last Name" />
                                                                            </f:facet>
                                                                            
                                                                            <h:outputText value="#{student.lastNm}" />
                                                                            
                                                                  </rich:column>
                                                                  <rich:column>
                                                                            <f:facet name="header">
                                                                                 <h:outputText value="First Name" />
                                                                            </f:facet>
                                                                            
                                                                            <h:outputText value="#{student.firstNm}" />
                                                                            
                                                                  </rich:column>
                                                                  <rich:column>
                                                                       <f:facet name="header">
                                                                            <h:outputText value="Program" />
                                                                       </f:facet>
                                                                       <h:outputText value="#{student.currentProgram}" />
                                                                  </rich:column>     
                                                                  <rich:column>
                                                                          <f:facet name="header">
                                                                            <h:outputText value="First Sem" />
                                                                       </f:facet>
                                                                       <h:outputText value="#{student.semesterByFirstSem.semester}" />
                                                                  </rich:column>
                                                                   <rich:column>
                                                                          <f:facet name="header">
                                                                             <h:outputText value="Advisor" />
                                                                       </f:facet>
                                                                       <h:selectOneMenu id="facAdvsor" 
                                                                             value="#{student.faculty}" >
                     <s:selectItems var="fac" value="#{adminSearch.listFaculty}"
                     label="#{fac}" noSelectionLabel="Select Advisor" />
                </h:selectOneMenu>
                                                                  </rich:column>
                                                      </rich:dataTable>

      The last column to be specific, is the drop down menu column.  I would like the user to select a row based on the dropdown.  If the table has 10 rows, and the user selects the 5th row dropdown, the contents of the 5th row(object details), should be passed to the backing bean. 


      Could someone help me out with this.

      Normally I have tried, a4j:support, where in rows of the dataTable are clickable.  But this is a bit different in which, the dropdown selection determines the row selection.

      thanks
      Sai