[OpenLayers-Users] Search for features, show popup when select
Andreas Hocevar
ahocevar at opengeo.org
Wed Jan 20 09:04:42 EST 2010
Herman Badenhorst wrote:
>
> 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?
OpenLayers.Popup or GeoExt.Popup? If the latter, then this is the wrong
list.
If the former, then have a look at
http://www.openlayers.org/dev/examples/sundials.html, which should help
you figure it out.
Regards,
Andreas.
>
> 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);
>
> }
>
> }
>
> })
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list