This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

JQgrid header searchable

Forum to discuss ExtJS and other JS plugins

JQgrid header searchable

by xidy » Sat Jun 05, 2010 12:01 pm

Hi, I need to implement JQgrid width header searcheable (in toolbar)like this toolbarsearch

But I don't know how to make the filters, how to comlete my actions. I use doctrine an Symfony 1.4

Thanks in advance

Here's my HTML code :

Code: Select all
<div id="searchContact">
                                <table id="rechercheContact"></table>
                                <div id="ptoolbar" ></div>

Here's my JS code :

Code: Select all
            datatype: "json",
            loadtext: "Chargement",
            height: 250,
            jsonReader : {root:"cellule"},
            emptyrecords: "Aucun enregistrement",
            colNames:['Nom','Prenom','Localite','Code Postal','Commentaire'],
                {name:'Nom',index:'Nom', sortable: false },
                {name:'Prenom',index:'Prenom', sortable: false},
                {name:'Localite',index:'Localite', sortable: false},
                {name:'CodePostal',index:'CodePostal', sortable: false},
                {name:'Commentaire',index:'Commentaire', sortable: false},
            scrollOffset: 0,
            sortname: 'Nom',
            $sortorder: 'asc',
            caption: "Contact(s)",
            viewrecords: true

        jQuery("#rechercheContact").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false});

and finally my action:

Code: Select all
public function executeTrouverContact(sfWebRequest $request) {

    $this->contacts = Doctrine_Query::create()
    ->from('Contact c')
    ->where('nom LIKE \'%'.$request->getParameter('recherche').'%\'')
    ->orWhere('prenom LIKE \'%'.$request->getParameter('recherche').'%\'')
    ->orWhere('code_postal LIKE \'%'.$request->getParameter('recherche').'%\'')
    ->orWhere('localite LIKE \'%'.$request->getParameter('recherche').'%\'')
    ->orWhere('commentaire LIKE \'%'.$request->getParameter('recherche').'%\'')

        $inscriptions = array();
        if ($request->isXmlHttpRequest()) {

                if (!is_null($this->contacts) && !empty($this->contacts)) {

                    $id = 1;

                        foreach ($this->contacts as $contact) {
                            $inscriptions['cellule'][] = array(
                                    'id'        => "$id",
                                    'cell'      => array($contact->getNom(),$contact->getPrenom(),


                    $this->getResponse()->setHttpHeader('Content-Type','application/json; charset=utf-8');
                    $inscriptions = $this->renderText(json_encode($inscriptions));
        return $inscriptions;
Junior Member
Posts: 1
Joined: Sat Jun 05, 2010 11:55 am