php - Symfony2 implement a input text and reload a list of elements -



php - Symfony2 implement a input text and reload a list of elements -

i'm new symfony2 , need few of guide implmement 1 thing.

i have input text, , table info database.

i want when user type text input text, table reload new info database.

function want phone call controller:

public function reloadcountryaction($name){ $em = $this->getdoctrine()->getentitymanager(); $qb = $em->createquerybuilder(); $qb->select("*") ->from("country","p") ->where("p.countryname '%:identifier%'") ->setparameter('identifier', $name); homecoming $qb->getarrayresult(); }

input text user type item search:

<input type="search" id="searchcountry" >

the function feed table first time:

public function countrylistaction() { $usr = $this->get('security.context')->gettoken()->getuser(); $allcountry = $this->getdoctrine() ->getrepository('backendentitybundle:country') ->findall(); homecoming $this->render('backendcountrybundle:default:countryfirst.html.twig', array('sessionname' => $usr->getusername(), 'allcountry' => $allcountry)); }

and table want reload:

<table id="selectabletablecountry"> {% country in allcountry %} <tr id="rowtable" class="ui-widget-content"> <td> <p class="txtcountryname">{{ country.countryname}}</p> </td> </tr> {% endfor %} </table>

thanks

it s javascript problem, not symfony. should utilize ajax phone call reload datas database, or post when unfocus triggered on element.

php symfony2 search input doctrine

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

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