2 Replies Latest reply on Jan 28, 2012 2:53 PM by Mahesh Bonagiri

    Highlight a row in a rich:dataTable

    Andy Peer Newbie

      Hi, I have a rich:dataTable and with onRowClick attribute, I change the background color of the selected row.

      I have a problem with pagination. For example, if I am on first page and click on the first row, when I go to the second page and then go back to the first one, I find its first row no more highlighted.

      Is there a way to remember the state of the clicked row?

       

      Thanks in advance.

        • 1. Re: Highlight a row in a rich:dataTable
          Tom Giberius Newbie

          Think about how you change the background color.

          What happens is you table is re-rendered, will your construction then work?

          • 2. Re: Highlight a row in a rich:dataTable
            Mahesh Bonagiri Newbie

            use following code

            <a4j:support event="onRowClick"

                                                                                                      action="#{cFormBuilderIndex.selectRow}">

                                                                                                      <a4j:actionparam name="selRow" value="#{result.rowId}"

                                                                                                                assignTo="#{cFormBuilderIndex.selectedRow}" />

                                                                                            </a4j:support>

             

            use a unique identifier in your DTO for identifying the record which is rowId in this case.