title: multiple zend pagination controls via ajax and jquery
body: <p>Can someone help me achieve multiple zend pagination in a view using ajax. I have managed to achieve single pagination no problem, but now i want to perform more than 1.  </p>
  
  <p>this is my setup:-</p>
  
  <p>added to the bootstrap:-</p>
  
  <pre><code>public function _initPaginator(){
      Zend_Paginator::setDefaultScrollingStyle('Sliding');
      Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_control.phtml');   
  }
  </code></pre>
  
  <p>'pagination_control.phtml' has been taken from the zend framework manual.</p>
  
  <p>added to the controller:-</p>
  
  <pre><code>public function init()
  {
      parent::init();
  
      $ajaxContext = $this-&gt;_helper-&gt;getHelper('AjaxContext');
      $ajaxContext-&gt;addActionContext('view', 'html')
                  -&gt;initContext();
  }
  </code></pre>
  
  <p>added this to the controller action:-</p>
  
  <pre><code>public function viewAction()
  {
  
      $query = $this-&gt;_em-&gt;createQueryBuilder()
         -&gt;select('t')
         -&gt;from('Ajfit\Entity\Ticket', 't')
         -&gt;where('t.engineerFk = :engineer')
         -&gt;orderBy('t.dt', 'desc')
         -&gt;setParameter('engineer', $engineer)
         -&gt;getQuery();
  
      $paginator =  new Paginator($query);
      $adapter-&gt;getIterator();
  
      $zend_paginator = new \Zend_Paginator($adapter);
      $zend_paginator-&gt;setItemCountPerPage(3)
                     -&gt;setCurrentPageNumber($this-&gt;_getParam('page'));
  
      $this-&gt;view-&gt;ticketPaginator = $zend_paginator;
  }
  </code></pre>
  
  <p>added this to the view:-</p>
  
  <pre><code>&lt;div&gt;
      &lt;div id="ticket-history"&gt;
         &lt;?php 
               echo $this-&gt;render('profile/view.ajax.phtml'); 
           ?&gt;
         &lt;/div&gt; 
  &lt;/div&gt;
  
  &lt;script&gt;
      $(document).ready(function() {
          $('.pagination-control').find('a').live('click', function(e) { 
              var link = $(this); 
              $('#ticket-history').load(link.attr('href'), { format: 'html' }); 
              return false;
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>my 'profile/view.ajax.phtml' script contains:-</p>
  
  <pre><code>&lt;?php
  
       echo '&lt;table border="0" width="100%" cellspacing="3" cellpadding="3"&gt;&lt;tr&gt;';
  
       foreach($this-&gt;ticketPaginator as $ticket){
           echo '&lt;td&gt;' . $ticket-&gt;getSubject() . '&lt;/td&gt;';
       }
  
       echo '&lt;/tr&gt;&lt;/table&gt;';
   ?&gt;
  
  &lt;?php 
      echo $this-&gt;paginationControl($this-&gt;ticketPaginator);
  ?&gt;
  </code></pre>
  
  <p>This all works fine, however, how would one go about adding a second or third paginator to this view for a different doctrine entity?</p>
  
  <p>Any help would be much apprieciated.</p>
  
  <p>Thanks</p>
  
  <p>Andrew</p>