title: How to get the current page number of dataTable using Jquery
body: <p>I have tried the solutions provided in 
  <a href="https://stackoverflow.com/questions/5422150/richdatatable-paging-marking-visited-pages-of-richdatascroller">rich:dataTable paging - marking visited pages of rich:datascroller</a>
  but it didn't work with rich faces 4.3.4.</p>
  
  <p>I have also tried page attribute of data scroller. Here's my code implementing page attribute of datascroller.</p>
  
  <pre><code> &lt;h:form id="mainForm"&gt;
       &lt;rich:dataScroller for="itemDataTable" maxPages="30" execute="itemDataTable" page="#{itemsController.pageIndex}"/&gt;                                 
       &lt;rich:dataTable rowKeyVar="rkVar" rows="15" id="itemDataTable" value="#{itemsController.itemDM}" var="r"&gt;
       &lt;f:facet name="footer"&gt;
          &lt;h:outputText id="pageNumberOutPutText" value="#{itemsController.pageIndex}"/&gt;
       &lt;/f:facet&gt;
          &lt;h:column id="setValue"&gt;
              &lt;h:inputText id="finalItem" valueChangeListener="#{itemsController.recalculate()}" value="#{r.items.prices}"/&gt;
          &lt;/h:column&gt;
          ...
          ...
      &lt;!-- other columns --&gt; 
      &lt;/rich:dataTable&gt;
      &lt;rich:dataScroller for="itemDataTable" maxPages="30" execute="itemDataTable" page="#{itemsController.pageIndex}"/&gt;                                      
  &lt;/h:form&gt;
  </code></pre>
  
  <p>I have respective getters and setters in my itemsController class and with following scope:</p>
  
  <pre><code>@ManagedBean
  @ViewScoped
  </code></pre>
  
  <p>with pageIndex intially set to 1.</p>
  
  <pre><code>private int pageIndex = 1;
  </code></pre>
  
  <p>And I tried to alert the current page number using:</p>
  
  <pre><code>alert('You are in page : ' + $('#mainForm\\:itemDataTable\\:pageNumberOutPutText').val());
  </code></pre>
  
  <p>But it alerts only 1. Also the outputText in the datatable footer shows only 1 even if I click next page or click other pages.</p>
  
  <p>Above all, all I wanted to do is alert the current page number using JQuery. I also dont want to use getters and setters for this, if possible. I really wanted to know how to get the current page number using Jquery.</p>