4 Replies Latest reply on Apr 23, 2007 1:45 PM by sergeysmirnov

    rich:datatable question..

    icai

      Hi,

      Following is my code which uses <rich:datable>. I fire gototurnOn() on onRowClick event. gototurnOn takes control to turnOn action os backing bean.

      <rich:dataTable id="searchresDataTable"
       binding="#{backing_CustSearchBean.searchresDataTable}" headerClass="isell_header"
       onRowMouseOver="this.style.backgroundColor='#ECF2FE'"
       onRowMouseOut="this.style.backgroundColor='#FFFFFF'"
       var="myList" value="#{processScope.rsBean.custInfoDao}"
       style="margin-top: 5px; cursor: pointer;overflow: auto;"
       styleClass = "dt_normal"
       rowClasses="searchcusttoprow,searchcustrows"
       onRowClick="gototurnOn('#{myList.first_name}', '#{myList.last_name}', '#{myList.country}', '#{myList.phone}','#{myList.email}'); showAllWheel('form1:srchwheel');"
       columnClasses="searchcustcols,searchcustmidcols,searchcustcols"
       >
       <rich:column>
       <h:outputText value="#{myList.first_name}" style="margin-left: 5px;"/>
       <h:outputText value=" "/>
       <h:outputText value="#{myList.last_name}"/>
       <h:panelGrid style="margin-left: 5px;">
       <h:outputText value="#{myList.country}"/>
       </h:panelGrid>
       </rich:column>
       <rich:column>
       <h:outputText value="#{myList.address}" style="margin-left: 5px;"/>
       <h:panelGrid columns="2" border="0" style="margin-left: 5px;">
       <h:outputText value="#{myList.city}"/>
       <h:outputText value="#{myList.state}"/>
       </h:panelGrid>
       </rich:column>
       <rich:column>
       <h:panelGrid border="0" columns="1" style="text-align: left; margin-left: 1px;" >
       <h:outputText value="#{myList.email}"/>
      
       <h:outputText value="#{myList.phone}" style="text-align: right;" />
       </h:panelGrid>
       </rich:column>
      
       </rich:dataTable>
      
       <a4j:jsFunction name="gototurnOn" action="#{backing_CustSearchBean.TurnOn}" oncomplete="enableOpp();stopAllWheel('form1:srchwheel');" >
       <a4j:actionparam name="custFName"/>
       <a4j:actionparam name="custLName" />
       <a4j:actionparam name="custCountry" />
       <a4j:actionparam name="custPhone" />
       <a4j:actionparam name="custEmail" />
       </a4j:jsFunction>
      

      Can it be possible that the row which is selected in datatable gets highlighted when the control comes back from the turnOn action. Somehow i have to indicate to user, which row he has selected.

      Please help...
      Thanks in advance!!



        • 1. Re: rich:datatable question..

          Do you have a strong reason why do not turn it before? What if user clicks it again? Did you try to use a4j:support event="onRowClick" instead of using jsFunction ?

          • 2. Re: rich:datatable question..
            icai

            Users want to see the row which they selected, highlighted. If you select the same row again, it should remain highlighted and same action will be triggered. I hope it is doable.. Please advise.

            I have not tried using <a4j:support> yet, but are there any advantages with it? <a4j:jsFunction> is also working in desired manner.

            Thanks in advance!

            • 3. Re: rich:datatable question..
              icai

              Users want to see the row which they selected, highlighted. If you select the same row again, it should remain highlighted and same action will be triggered. I hope it is doable.. Please advise.

              I have not tried using <a4j:support> yet, but are there any advantages with it? <a4j:jsFunction> is also working in desired manner.

              Thanks in advance!

              • 4. Re: rich:datatable question..

                if you highlight the row right from the onRowClick, user will be able to see the selected row. Moreover, she will be able to do so without post-request delay.

                Using a4j:support has a priority from the architectural point of view. However, if using jsFunction is OK for you, you can keep it.