<div dir="ltr">Hello everybody,<div style>am new to GeoEXT and am trying to do the search with form panel.</div><div style>and i want to search features from 2 postgis table, corresponding the field on the formpanel and show them on two separated grid panels, </div>
<div style>when i hit the search button i get nothing on my gridpanel :s</div><div style>here&#39;s my java script code: </div><div style><br></div><div style><font color="#0000ff"><br></font></div><div style><div><font color="#0000ff">// define the data source</font></div>
<div><font color="#0000ff">   <span class="" style="white-space:pre">                </span></font></div><div><font color="#0000ff"><span class="" style="white-space:pre">                </span>var protocol= OpenLayers.Protocol.WFS({</font></div>
<div><font color="#0000ff">            url: &quot;<a href="http://localhost:8080/geoserver/wfs">http://localhost:8080/geoserver/wfs</a>&quot;,</font></div><div><font color="#0000ff">            featureType: &quot;titres_salemed_valid&quot;,</font></div>
<div><font color="#0000ff">            featureNS: &quot;<a href="http://geoserver.org/ancfcc">http://geoserver.org/ancfcc</a>&quot;</font></div><div><font color="#0000ff">        });</font></div><div><font color="#0000ff"><br>
</font></div><div><font color="#0000ff"><span class="" style="white-space:pre">                </span>var protocol2= OpenLayers.Protocol.WFS({</font></div><div><font color="#0000ff">            url: &quot;<a href="http://localhost:8080/geoserver/wfs">http://localhost:8080/geoserver/wfs</a>&quot;,</font></div>
<div><font color="#0000ff">            featureType: &quot;bornes_salemed_valid&quot;,</font></div><div><font color="#0000ff">            featureNS: &quot;<a href="http://geoserver.org/ancfcc">http://geoserver.org/ancfcc</a>&quot;</font></div>
<div><font color="#0000ff">        });</font></div><div><span class="" style="white-space:pre"><font color="#0000ff">                </font></span></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff">  formPanel = new Ext.form.FormPanel({</font></div>
<div><font color="#0000ff">            title: &quot;Recherche T/R&quot;,</font></div><div><font color="#0000ff">            height: 200,</font></div><div><font color="#0000ff">            region: &quot;north&quot;,</font></div>
<div><font color="#0000ff">            items: [{</font></div><div><font color="#0000ff">                xtype: &quot;textfield&quot;,</font></div><div><font color="#0000ff">                name: &quot;nature__eq&quot;,</font></div>
<div><font color="#0000ff">                value: &quot;T&quot;,</font></div><div><font color="#0000ff">                fieldLabel: &quot;Nature&quot;</font></div><div><font color="#0000ff">            },{</font></div><div>
<font color="#0000ff">               xtype: &quot;textfield&quot;,</font></div><div><font color="#0000ff">               name: &quot;indice__eq&quot;,</font></div><div><font color="#0000ff">               value: &quot;20&quot;,</font></div>
<div><font color="#0000ff"><span class="" style="white-space:pre">                        </span>   fieldLabel: &quot;Indice&quot;</font></div><div><font color="#0000ff">            },{</font></div><div><font color="#0000ff">               xtype: &quot;textfield&quot;,</font></div>
<div><font color="#0000ff">               name: &quot;num__eq&quot;,</font></div><div><font color="#0000ff">               value: &quot;&quot;,</font></div><div><font color="#0000ff"><span class="" style="white-space:pre">                        </span>   fieldLabel: &quot;Num:&quot;</font></div>
<div><font color="#0000ff">            },{</font></div><div><font color="#0000ff">               xtype: &quot;textfield&quot;,</font></div><div><font color="#0000ff">               name: &quot;complement__eq&quot;,</font></div>
<div><font color="#0000ff">               value: &quot;&quot;,</font></div><div><font color="#0000ff"><span class="" style="white-space:pre">                        </span>   fieldLabel: &quot;Complement:&quot;</font></div><div><font color="#0000ff">              }],</font></div>
<div style><font color="#0000ff"><span class="" style="white-space:pre">        </span>    </font></div><div style><span class="" style="white-space:pre"><font color="#0000ff">                // here action on search button </font></span></div>
<div><span class="" style="white-space:pre"><font color="#0000ff">                </font></span></div><div><font color="#0000ff"><span class="" style="white-space:pre">                </span>buttons: [{text: &#39;Localiser&#39;,</font></div><div><font color="#0000ff">            handler: function(){</font></div>
<div><font color="#ff0000">// here to populate the store 2 with feature from table 2 defined by protocol 2</font></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff">                        formPanel.getForm().doAction(searchAction2, {</font></div>
<div><font color="#0000ff">                        callback: function(response) {</font></div><div><span class="" style="white-space:pre"><font color="#0000ff">                                                        </font></span></div><div><font color="#0000ff">                                        features2 = searchAction2.response.features;</font></div>
<div><font color="#0000ff"><span class="" style="white-space:pre">                </span>            <span class="" style="white-space:pre">        </span>            <span class="" style="white-space:pre">        </span>store2.loadData(features2);</font></div>
<div><span class="" style="white-space:pre"><font color="#0000ff">                        </font></span></div><div><font color="#0000ff">                         };</font></div><div><font color="#0000ff"><span class="" style="white-space:pre">                                                </span> </font></div>
<div><font color="#0000ff"><span class="" style="white-space:pre">                                                </span> };</font></div><div><span class="" style="color:rgb(0,0,255);white-space:pre">        </span><font color="#ff0000">// here to populate the store with feature from table  defined by protocol</font><font color="#0000ff">  </font></div>
<div><font color="#0000ff"><span class="" style="white-space:pre">                                                </span> </font></div><div><font color="#0000ff">                        formPanel.getForm().doAction(searchAction2, {</font></div><div><font color="#0000ff"><span class="" style="white-space:pre">                        </span>      <span class="" style="white-space:pre">                </span>callback: function(response) {</font></div>
<div><span class="" style="white-space:pre"><font color="#0000ff">                                                        </font></span></div><div><font color="#0000ff">                                        features2 = searchAction2.response.features;</font></div><div>
<font color="#0000ff"><span class="" style="white-space:pre">                </span>                        <span class="" style="white-space:pre">                </span>store2.loadData(features2);</font></div><div><span class="" style="white-space:pre"><font color="#0000ff">                        </font></span></div>
<div><font color="#0000ff">    };</font></div><div><span class="" style="white-space:pre"><font color="#0000ff">                        </font></span></div><div><font color="#0000ff">    };</font></div><div><font color="#0000ff">  </font></div>
<div><font color="#0000ff">            }</font></div><div><font color="#0000ff">        }]</font></div><div><span class="" style="white-space:pre"><font color="#0000ff">                </font></span></div><div><font color="#0000ff">    });</font></div>
<div><font color="#0000ff">   </font></div><div><font color="#0000ff">  var searchAction = new GeoExt.form.SearchAction(formPanel.getForm(), {</font></div><div><font color="#0000ff">        protocol: protocol,</font></div>
<div><font color="#0000ff">        abortPrevious: true</font></div><div><span style="color:rgb(0,0,255)">    });</span><font color="#0000ff">  </font></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff"> var searchAction2 = new GeoExt.form.SearchAction(formPanel.getForm(), {</font></div>
<div><font color="#0000ff">        protocol: protocol2,</font></div><div><font color="#0000ff">        abortPrevious: true</font></div><div><font color="#0000ff">    });</font></div><div><font color="#0000ff"><br></font></div>
<div><font color="#0000ff"> var cols = [ {name: &#39;titref&#39;, type: &#39;string&#39;},</font></div><div><font color="#0000ff">                 {name: &#39;mappe&#39;, type: &#39;string&#39;},</font></div><div><font color="#0000ff">                 {name: &#39;type&#39;, type: &#39;string&#39;}</font></div>
<div><font color="#0000ff">               ];</font></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff">        var reader = new GeoExt.data.FeatureReader({},cols);</font></div><div><font color="#0000ff"><br>
</font></div><div><font color="#0000ff">        var store = new GeoExt.data.FeatureStore({</font></div><div><font color="#0000ff">            reader: reader,</font></div><div><font color="#0000ff">            fields: cols,</font></div>
<div><font color="#0000ff">            autoLoad: false</font></div><div><font color="#0000ff">        });</font></div><div><span class="" style="white-space:pre"><font color="#0000ff">                </font></span></div><div><span class="" style="white-space:pre"><font color="#0000ff">                </font></span></div>
<div><font color="#0000ff"><span class="" style="white-space:pre">                </span>// pour les titres </font></div><div><span class="" style="white-space:pre"><font color="#0000ff">                </font></span></div><div><font color="#0000ff"><span class="" style="white-space:pre">                </span>var cols2 = [ {name: &#39;name&#39;, type: &#39;string&#39;},</font></div>
<div><font color="#0000ff">                 {name: &#39;x&#39;, type: &#39;string&#39;},</font></div><div><font color="#0000ff">                 {name: &#39;y&#39;, type: &#39;string&#39;}</font></div><div><font color="#0000ff">               ];</font></div>
<div><font color="#0000ff"><br></font></div><div><font color="#0000ff">        var reader2 = new GeoExt.data.FeatureReader({},cols2);</font></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff">        var store2 = new GeoExt.data.FeatureStore({</font></div>
<div><font color="#0000ff">            reader: reader2,</font></div><div><font color="#0000ff">            fields: cols2,</font></div><div><font color="#0000ff">            autoLoad: false</font></div><div><font color="#0000ff">        });</font></div>
<div><font color="#0000ff"><div>// create grid panel configured with feature store</div><div>        gridPanel = new Ext.grid.GridPanel({</div><div>            title: &quot;results&quot;,</div><div>            region: &quot;center&quot;,</div>
<div>            store: store2,</div><div>            height: 100,</div><div>            columns: [{</div><div>                header: &quot;titref&quot;,</div><div>                width: 200,</div><div>                sortable: true,</div>
<div>                dataIndex: &quot;titref&quot;</div><div>            }, {</div><div>                header: &quot;mappe&quot;,</div><div>                width: 60,</div><div>                sortable: true,</div><div>                 dataIndex: &quot;mappe&quot;</div>
<div>            }, {</div><div>                header: &quot;type&quot;,</div><div>                width: 60,</div><div>                align: &#39;right&#39;,</div><div>                sortable: true,</div><div>                dataIndex: &quot;type&quot;</div>
<div>            }],</div><div>            sm: select</div><div>        });</div><div><span class="" style="white-space:pre">                </span></div><div><span class="" style="white-space:pre">                </span>// create grid panel configured with feature store for bornes layer</div>
<div>        gridPanel2 = new Ext.grid.GridPanel({</div><div>            title: &quot;tableau des bornes&quot;,</div><div>            region: &quot;south&quot;,</div><div>            store: store2,</div><div>            height: 250,</div>
<div>            columns: [{</div><div>                header: &quot;name&quot;,</div><div>                width: 100,</div><div>                sortable: true,</div><div>                dataIndex: &quot;name&quot;</div><div>
            }, {</div><div>                header: &quot;x&quot;,</div><div>                width: 120,</div><div>                sortable: true,</div><div>                dataIndex: &quot;x&quot;</div><div>            }, {</div>
<div>                header: &quot;y&quot;,</div><div>                width: 120,</div><div>                align: &#39;right&#39;,</div><div>                sortable: true,</div><div>                dataIndex: &quot;y&quot;</div>
<div>            }],</div><div>            sm: select2</div><div>        });</div><div><span class="" style="white-space:pre">                </span></div></font></div><div><span class="" style="white-space:pre"><font color="#0000ff">                </font></span></div>
<div><span class="" style="white-space:pre"><font color="#0000ff">                </font></span></div></div><div style><br></div><div style><br></div><div style><br></div><div style><br></div><div><div><br></div>-- <br><div dir="ltr">*Asma OUQALLI*<br>
<br>Élève ingénieur : 3ème  Sciences d&#39;Information Géographique (SIG).<br>Chef de commission développement professionnel  - Rotaract EHTP. <br>Chef de cellule Media - Olympiades EHTP 2012.<br>  Ecole Hassania des Travaux Publics.<br>
   Mobile : +212 672 48 23 15.<br>   Email : <a href="mailto:asma.ouqalli@gmail.com" target="_blank">asma.ouqalli@gmail.com</a><br><br></div>
</div></div>