1 Reply Latest reply on Oct 5, 2007 6:46 AM by ilya_shaikovsky

    scrollableDataTable - Select a Row

    echua

      Does anyone have an example where you select a row in a scrollableDataTable and get the row information from the table. I would like to pass this information to a bean or javascript so that I can repopulate the screen with more detailed information.

        • 1. Re: scrollableDataTable - Select a Row
          ilya_shaikovsky

          My simpliest example:

          <rich:modalPanel id="_panel">
           <f:facet name="header">
           <h:outputText value="Details"></h:outputText>
           </f:facet>
           <a4j:outputPanel id="details">
           <h:graphicImage value="#{capitalsBean.currentFlag}"></h:graphicImage>
           <h:panelGrid columns="2">
           <h:outputText value="State Name:"></h:outputText>
           <h:outputText value="#{capitalsBean.currentState}"></h:outputText>
           <h:outputText value="State Capital:"></h:outputText>
           <h:outputText value="#{capitalsBean.currentCapital}"></h:outputText>
           <h:outputText value="State TimeZone:"></h:outputText>
           <h:outputText value="#{capitalsBean.currentTimeZone}"></h:outputText>
           </h:panelGrid>
           </a4j:outputPanel>
           <h:outputLink value="#" onclick="javascript:Richfaces.hideModalPanel('_panel');">Close</h:outputLink>
           </rich:modalPanel>
           <h:form>
           <rich:scrollableDataTable value="#{capitalsBean.capitals}" var="cap" width="200px" height="250px">
           <a4j:support event="onRowClick" reRender="details" oncomplete="javascript:Richfaces.showModalPanel('_panel',{left:'auto', top:'auto'})">
           <a4j:actionparam name="cur1" value="#{cap.name}" assignTo="#{capitalsBean.currentCapital}"/>
           <a4j:actionparam name="cur2" value="#{cap.state}" assignTo="#{capitalsBean.currentState}"/>
           <a4j:actionparam name="cur3" value="#{cap.timeZone}" assignTo="#{capitalsBean.currentTimeZone}"/>
           <a4j:actionparam name="cur4" value="#{cap.stateFlag}" assignTo="#{capitalsBean.currentFlag}"/>
           </a4j:support>
           <rich:column>
           <h:outputText value="#{cap.name}"></h:outputText>
           </rich:column>
           <rich:column>
           <h:outputText value="#{cap.state}"></h:outputText>
           </rich:column>
           <rich:column>
           <h:graphicImage value="#{cap.stateFlag}"></h:graphicImage>
           </rich:column>
           </rich:scrollableDataTable>
           </h:form>
          


          So, there you can see:
          1) Every rowclick request fired
          2) current Row values assigned to some properties using actionParam.
          3) Modal Panel values updated
          4) It shown after request completed.