[OpenLayers-Users] Search for features, show popup when select

Herman Badenhorst hbadenhorst at hotmail.com
Wed Jan 20 07:06:36 EST 2010


Hi group.

What i need to do is display a list of search results in the grid panel.
When user clicks on a record, highlight the feature and display a popup with
the feature attributes.
The code below does all except the popup. How would i go about displaying
the popup?

Regards,
Herman

                      *new* Ext.grid.GridPanel({

                          title: 'Search results',

                          region: 'center',

                          ds: store,

                          sm: sm,

                          autoSizeColumns: *true*,

                          viewConfig: {

                              forceFit: *true*,

                              autoFill: *true*

                           },


                          height: 300,

                          columns: [{

                                  header: 'mapunit',

                                  dataIndex: 'mapunit',

                                  width: 50

                              }

                          ],

                          listeners: {

                              'rowclick': {

                                  'fn': *function*(grid, index, evt) {

                                      *var* r =
grid.getStore().getAt(index);

                                      *var* feature = r.get('feature');

                                      *var* a = feature.attributes;



                                      vectorLayer.destroyFeatures();

                                      vectorLayer.addFeatures(feature);

                                      vectorLayer.redraw();





                                      *var* bounds =
feature.geometry.getBounds();


map.setCenter(bounds.getCenterLonLat(),map.getZoomForExtent(bounds));



//                                    popup code goes here?

                                   }

                               }

                           },

                           bbar: [{

                               text: 'Clear highlight',

                               handler: *function*() {


vectorLayer.removeFeatures(vectorLayer.features);

                               }

                           }

                      })
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100120/d125f0c9/attachment.html


More information about the Users mailing list