[Users] Geoext Popup Question

Jason Woolard Jason.Woolard at noaa.gov
Fri Jul 30 03:26:45 CEST 2010


Cool.. Thanks Adam!

That answered both questions and fixed the popup behavior. It was as 
easy as:

var selectCtrl = new 
OpenLayers.Control.SelectFeature([kmllayer1,kmllayer2,kmllayer3],{
                toggle: true,
                clickout: true
        });

Thanks again for the help..

Adam Ratcliffe wrote:
> Hi Jason,
>
> You can create a single SelectFeature control and pass an array
> containing all of the KML layers that you wish to be selectable as the
> first constructor parameter.
>
> Cheers
> Adam
>
> On Fri, Jul 30, 2010 at 8:45 AM, Jason Woolard <Jason.Woolard at noaa.gov> wrote:
>   
>> hi all,
>>
>> I've been able to cobble together some working popups from a kml layer
>> based on the tutorial and examples. Currently the popups only work when
>> a single layer is selected. If I turn on other layers the first selected
>> layer is the only layer that continues to work. I'm wondering if it's
>> possible to have the popups work when more than one layer in the tree is
>> selected?
>>
>> I'd also like to have several kml layers with popups on the page. What
>> I've done based on the examples is issue a new
>> OpenLayers.Control.SelectFeature for each kml layer,  the popups are
>> closed with something like this:
>>
>>  // unselect feature when the popup
>>  // is closed
>>        popup.on({
>>                close: function() {
>>                selectCtrl1.unselect(this.feature);
>>                selectCtrl2.unselect(this.feature);
>>                etc...
>>                etc...
>>                etc...
>>            }
>>            });
>>
>> And the popups are created with these:
>>
>>  // create popup on "featureselected"
>>            C17275410.events.on({
>>                featureselected: function(e) {
>>                    createPopup(e.feature);
>>                }
>>          });
>>
>>        // create popup on "featureselected"
>>            C17358063.events.on({
>>                 featureselected: function(e) {
>>                     createPopup(e.feature);
>>                 }
>>            });
>>
>> I wondering if I'm on the wrong track doing this the hard way or if
>> there is maybe a better way to create one popup and reuse it each time
>> you click the kml layer?
>>
>> The working page can be viewed at:
>> http://ngs.woc.noaa.gov/storms/nov09_ne/ge/2010dev/index6.html
>>
>> And the js at:
>> http://ngs.woc.noaa.gov/storms/nov09_ne/ge/2010dev/tree6.js
>>
>>
>> Thanks in advance for any comments or advice.
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>
>>     


More information about the Users mailing list