1 Reply Latest reply on Feb 2, 2012 12:48 PM by mcmurdosound

    DataTable + onRowClick event + RichFaces 3.3.3

    david.bono

      Hi all!

      I've a question about how made a single selection on a DataTable....

      This is my code that doesn' t work...

       

      jsp code

      <h:form>

                          <rich:dataTable value="#{myBean.myList}"

                                          var="item" width="600px"

                                          rowClasses="row1, row2" onRowMouseOver="this.style.backgroundColor='#B5F3FB'"

                                          onRowMouseOut="this.style.backgroundColor='#{a4jSkin.rowBackgroundColor}'"

                                          columnClasses="center" rows="5"

                                          onRowClick="#{myBean.selectedRow(item.id)}">

                              <%-- EVENT--%>

                              <a4j:support event="onRowClick"  onsubmit="this.style.backgroundColor='#EEEE00'" reRender="itemPaziente" actionListener="#{myBean.selectedRow(item.id)}"/>


                              <%-- HEADER OF TABLE --%>

                              <f:facet name="header">

                                  <h:outputText value="#{msg.medic_showPatients_title}"/>

                              </f:facet>


                              <%-- BODY TABELLA --%>

                              <rich:column sortBy="#{item.nome}">

                                  <f:facet name="header">

                                      <h:outputText value="#{msg.medic_showPatients_colonna1}"/>

                                  </f:facet>

                                  <h:outputText value="#{item.nome}"/>

                              </rich:column>

                              <rich:column sortBy="#{item.cognome}">

                                  <f:facet name="header">

                                      <h:outputText value="#{msg.medic_showPatients_colonna2}"/>

                                  </f:facet>

                                  <h:outputText value="#{item.cognome}"/>

                              </rich:column>

                              <rich:column sortBy="#{item.sesso}">

                                  <f:facet name="header">

                                      <h:outputText value="#{msg.medic_showPatients_colonna3}"/>

                                  </f:facet>

                                  <h:outputText value="#{item.sesso}"/>

                              </rich:column>


                              <%-- FOOTER --%>

                              <f:facet name="footer">

                                  <rich:datascroller id="ds"></rich:datascroller>

                              </f:facet>


                          </rich:dataTable>

                      </h:form>

       

      I've read a lot of post but I've find only problems about RichFaces 4.

      I must do my WebApplication with RichFaces 3.3.3 that have not event like AjaxBehaviorEvent.

      If I wanted use the javax.faces.event.ActionEvent, I could solve my problems?

       

      and bean code

      public class MyBean implements Serializable{

           private ArrayList<SBPazienti> myList = SBPazienti.getAll();

           private SBPaziente selected;

       

           public void selectedRow(Integer id){

                this.selected = new SBPaziente(id);

           }

          

           //getter and setter ......

      }

       

      Thanks in advance and sorry for my bad english!