title: primefaces datatable scroll down to position
body: <p>i am developing an application using jsf with primefaces, i need one help regarding primefaces datatable i have large number of datas in datatable with selection single or multiple option.</p>
  
  <p>I want to select the row automatically through action or default position which is selected.</p>
  
  <p>My need is when i am selecting 20th row in the table and goes into next page and do some process returns back to the same page but it is selected in the 20th row but it is not scrolled down yet.</p>
  
  <p>I need scroll down position to where it is selected and processed.</p>
  
  <p>Here is my code for view</p>
  
  <pre><code>&lt;p:dataTable id="reactionTable" var="reactions" value="#{curation.reactionsList}"
                                                  selection="#{curation.selectedReactions}" scrollable="true" scrollHeight="200" rows="10"
                                                  rowKey="#{reactions.id}" widgetVar="reactionVar"
                                                  style="width: 1350px; font-size: 13px;" filteredValue="#{curation.reactionsFilteredList}" 
                                                  resizableColumns="true"&gt;
         &lt;p:ajax event="rowToggle" listener="#{curation.toggleReaction}"/&gt;
         &lt;p:ajax event="rowSelect" listener="#{curation.showStages}" update="@form"/&gt;
         &lt;p:column selectionMode="multiple" style="width:5%" /&gt;  
         &lt;p:column headerText="Id" width="7%" filterBy="#{reactions.rxnId}" filterStyle="width: 35px;" filterMatchMode="contains" sortBy="#{reactions.rxnId}"&gt;
                                              #{reactions.rxnId}
        &lt;/p:column&gt;
        &lt;p:column headerText="RxnNo" width="9%" filterBy="#{reactions.rxnNo}" filterStyle="width: 35px;" filterMatchMode="contains" sortBy="#{reactions.rxnNo}"&gt;  
                                              #{reactions.rxnNo}  
         &lt;/p:column&gt;
          &lt;p:column headerText="RxnSeq" width="9%" filterBy="#{reactions.rxnSeq}" filterStyle="width: 25px;" filterMatchMode="contains" sortBy="#{reactions.rxnSeq}"&gt;  
                                              #{reactions.rxnSeq}  
         &lt;/p:column&gt;
                                          &lt;p:column headerText="RSD" width="40%" filterBy="#{reactions.rsd}" filterStyle="width: 250px;" filterMatchMode="contains" sortBy="#{reactions.rsd}"&gt;  
                                              #{reactions.rsd}  
          &lt;/p:column&gt;
          &lt;p:column headerText="RSN" width="40%" filterBy="#{reactions.rsn}" filterStyle="width: 250px;" filterMatchMode="contains" sortBy="#{reactions.rsn}"&gt;  
                                              #{reactions.rsn}  
          &lt;/p:column&gt;
          &lt;p:column headerText="RSN Free Type" width="40%" filterBy="#{reactions.rtf}" filterStyle="width: 250px;" filterMatchMode="contains" sortBy="#{reactions.rtf}"&gt;  
                                              #{reactions.rtf}  
          &lt;/p:column&gt;
          &lt;f:facet name="footer"&gt;   
          &lt;p:commandButton value="Copy" icon="ui-icon-search"  
                  update="reactionTable" actionListener="#{curation.copyReaction()}" style="height: 25px; font-size: 12px; font-weight: bold;"/&gt;
              &lt;p:commandButton value="Create RSD" id="create" actionListener="#{curation.createReaction()}" action="#{createReaction.createRsd()}" style="height: 25px; font-size: 12px; font-weight: bold;"/&gt;
              &lt;p:commandButton value="Update" id="ajax" update="@form" actionListener="#{curation.updateBatch}" style="height: 25px; font-size: 12px; font-weight: bold;"/&gt;    
          &lt;/f:facet&gt;
  </code></pre>
  
  <p></p>
  
  <p>but i've used one javascript for scrolling position fixed</p>
  
  <pre><code>var scrollPosition;
          function saveScrollPosition() {
              scrollPosition = $('#reactionTable').scrollTop();
          }
          function setScrollPosition() {
              $('#reactionTable').scrollTop(scrollPosition);
          }
  </code></pre>
  
  <p>but it didn't worked also
  Can anyone help me solve this problem</p>