pagerfanta used in a form with a search. symfony2 -



pagerfanta used in a form with a search. symfony2 -

i'd paging link render pagerfanta submitted form data. consider info entered in search form.

a simple pagination link not allow me navigate in search result. help please ?

controller

/** * @route("/{page}/", name="admin_user",requirements={"page" = "\d+"}, defaults={"page" = 1}) * @template() */ public function indexaction($page = 1) { $data = []; $data['name'] = $this->getuser()->getname(); $form = $this->createform('admin_user_search_type', null); $request = $this->getrequest(); if ($request->getmethod() == 'post') { $form->bind($request); $data = array_merge($data, $form->getdata()); } homecoming $this->render('aabundle:user:index.html.twig', array( 'pager' => $this->getdoctrine()->getmanager()->getrepoitory('aabundle:user')->search($data, 4, $page, $this->getuser()), 'form' => $form->createview(), )); }

view.html.twig

{% if pager.havetopaginate %} {{ pagerfanta(pager, 'twitter_bootstrap3') }} {% endif %}

the solution submit form methode instead of post able retrieve form info .also don't need check whether valid or not , while search form .

the controller shown below:

** * @route("/{page}/", name="admin_user",requirements={"page" = "\d+"}, defaults={"page" = 1}) * @template() */ public function indexaction($page = 1) { $data = []; $data['name'] = $this->getuser()->getname(); $form = $this->createform('admin_user_search_type', null); $request = $this->getrequest(); $form->bind($request); $data = array_merge($data, $form->getdata()); homecoming $this->render('aabundle:user:index.html.twig', array( 'pager' => $this->getdoctrine()->getmanager()->getrepoitory('aabundle:user')->search($data, 4, $page, $this->getuser()), 'form' => $form->createview(), )); }

the form.html.twig

<form name= "search" action="{{ path('admin_user') }}" novalidate method="get"{{ form_enctype(form) }}> </form>

symfony2 pagerfanta

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -