title: Symfony 2.1 ajax filter with KNP Paginator Bundle
body: <p>Hi, I have page with a table with a list of elements (index.html.twig.). I'm using KNP Paginator Bundle to paginate the result. Now I want to implement some kind of filters in this page to filter the table result. I'm using AJAX to do this, so I create another view (grupos.html.twig) with the table and the paginator inside to  render the result of the query.
  Here is the controller code:</p>
  
  <pre><code>public function filtrarGrupoPorLetraAction(){
   if ($this-&gt;getRequest()-&gt;isXmlHttpRequest()) {
     $em = $this-&gt;getDoctrine()-&gt;getManager();
     $letra = $this-&gt;getRequest()-&gt;get('letra');
     $entities = $em-&gt;getRepository('GrupoBundle:Grupo')-&gt;filtrar($letra);
  
     $paginator = $this-&gt;get('knp_paginator');
     $pagination = $paginator-&gt;paginate(
       $entities,
       $this-&gt;get('request')-&gt;query-&gt;get('page', 1) /*page number*/,
       25/*limit per page*/
     );
  
     return $this-&gt;render('GrupoBundle:Grupo:grupos.html.twig', compact('pagination'));
   }
  }
  </code></pre>
  
  <p>but this code render a new page and I want to pass the result to index.html.twig to render a div.</p>
  
  <p>How can I do this?</p>