title: Grails Pagination
body: <p>Hello im back with another tedious question!</p>
  
  <p>Trying to get my table to paginate. There are 12 users in the table. Here is my controller function</p>
  
  <pre><code>    def listDuplicates(params) {
         def result = User.getAllWithDuplicateIDs()
         def totalDupCount = result.size()
  
           /*sout for troubleshooting */  
          System.out.println("Duplicate:" + result.ID + " " + result.username)
  
         params.max = Math.min(params.max ? params.int('max') : 10, 100)
         return [resultList: result, totalDupCount: totalDupCount, params:params ]
  
  }
  </code></pre>
  
  <p>Here is my view</p>
  
  <pre><code>        &lt;div&gt;
          &lt;fieldset class="warningFieldSet"&gt;
              &lt;h1 style="color: red" align="center"&gt;
                  &lt;g:message code="Duplicate IDs" /&gt;
  
              &lt;/h1&gt;
              &lt;p style="color: red; margin-left: 20px;"&gt;Duplicate IDs Found!&lt;/p&gt;
                  &lt;table&gt;
                      &lt;thead&gt;
                          &lt;tr&gt;
  
                              &lt;g:sortableColumn property="Username" title="Username" /&gt;
                              &lt;g:sortableColumn property="ID" title="ID" /&gt;
                              &lt;g:sortableColumn property="Status" title="Status" /&gt;
                          &lt;/tr&gt;
                      &lt;/thead&gt;
  
                      &lt;tbody&gt;
                          &lt;g:each in="${resultList}" status="i" var="resultDuplicate"&gt;
                              &lt;tr class="${(i % 2) == 0 ? 'even' : 'odd'}"&gt;
                                  &lt;td&gt;
                                      ${resultDuplicate.username}
                                  &lt;/td&gt;
  
                                  &lt;td style="color: red; font-weight: bold"&gt;
                                      ${resultDuplicate.id}
                                  &lt;/td&gt;
  
                                  &lt;td&gt;
                                      ${resultDuplicate.accountStatus }
  
                              &lt;/tr&gt;
                          &lt;/g:each&gt;
                      &lt;/tbody&gt;
                      &lt;tfoot&gt;
                          &lt;g:if test="${totalDupCount &gt;10 }"&gt;
                              &lt;div class="paginateButtons"&gt;
                                  &lt;g:paginate action= "listDuplicates" total="${totalDupCount}" /&gt;
                              &lt;/div&gt;
                          &lt;/g:if&gt;
                      &lt;/tfoot&gt;
                  &lt;/table&gt;
  
              &lt;/fieldset&gt;
  
      &lt;/div&gt;
  </code></pre>
  
  <p>Domain function for finding the duplicate IDs</p>
  
  <pre><code>  static List&lt;User&gt; getAllWithDuplicateIDs() {
  
      findAll("FROM User WHERE id IN (SELECT id FROM User group by id having count(*) &gt; 1) AND id != ''   ", [])
  
  }
  </code></pre>
  
  <p>The buttons show up. And in the URL the offset and max is displayed. The table just puts all 12 displayed instead of 10 on one page and 2 on the other. 2 Page numbers show up so It knows that it is only suppose to display only 10 per page. It just isn't doing it in the table itself. Im assuming its some kind of issue with passing params and such. </p>
  
  <p>Any Suggestions/Opinions/Help are/is greatly appreciated!</p>