Hi,

a very elegant solution, which depends on 
http://trac.osgeo.org/openlayers/ticket/2983, would be to register for the 
layer's "added" event and continue when it is added.

Andreas.

On Jan 12, 2011, at 20:18 , Alexandre Dube wrote:

> Hi,
> 
>   I just hit the exact same issue here.  I was using an old proposed 
> patch on ticket 235 [1] where the layer record, when rendered, registers 
> an event to the record.layer.map, but the layer hasn't been added to the 
> map yet so it's null.
> 
>   I'll try the Mixin pluggin instead, but I can see in it that it's 
> guessing the mappanel and in my app I have two.  I'll see what it does...
> 
>   Figured it was useful to tell.
> 
> Regards,
> 
> Alexandre
> 
> [1] http://trac.geoext.org/ticket/235
> 
> 
> On 11-01-12 11:50 AM, Matt Priour wrote:
>> Forgot the ticket link:
>> [1] http://trac.geoext.org/ticket/396
>> 
>> Matt Priour
>> Kestrel Computer Consulting
>> 
>> --------------------------------------------------
>> From: "Matt Priour"<[email protected]>
>> Sent: Wednesday, January 12, 2011 9:10 AM
>> To: "Eric Lemoine"<[email protected]>
>> Cc: "GeoEXT Dev"<[email protected]>
>> Subject: Re: [Dev] Lazy loading of map panel layers
>> 
>>> Thanks for that suggestion Eric.
>>> I have opened a ticket [1] for this issue, and attached a patch with an
>>> example fix for two classes. If this approach seems sound, then I would be
>>> happy to fix the remaining 7 components and add tests for this use case.
>>> 
>>> An alternative approach would be to add the GeoExt.MapPanel's map property
>>> to the layers in the GeoExt.MapPanel layers configuration option when it
>>> uses an array of OpenLayers.Layer objects. However, that could interfere
>>> with OpenLayers code and various tests it does to determine if a layer has
>>> been added to a map or not. So I don't think that is a good approach.
>>> 
>>> --------------------------------------------------
>>> From: "Eric Lemoine"<[email protected]>
>>> Sent: Wednesday, January 12, 2011 12:45 AM
>>> To: "Matt Priour"<[email protected]>
>>> Cc: "GeoEXT Dev"<[email protected]>
>>> Subject: Re: [Dev] Lazy loading of map panel layers
>>> 
>>>> On Wednesday, January 12, 2011, Matt Priour<[email protected]>
>>>> wrote:
>>>>> Given the change in the way layers configured in the map panel are
>>>>> loaded
>>>>> in
>>>>> the map:
>>>>> 
>>>>> (http://trac.geoext.org/wiki/Release/1.0/Notes): "Layers configured in
>>>>> the
>>>>> MapPanel's layers property won't be added to the map before it is
>>>>> rendered.
>>>>> This is a behavioral change that may require changes in code that relies
>>>>> on
>>>>> a layer's map property before the map is rendered."
>>>>> 
>>>>> Are there plans to change the internal GeoExt code so that components
>>>>> which
>>>>> rely on the layer's map property are initialized after the layer is
>>>>> added
>>>>> to
>>>>> the map or instead use the GeoExt.MapPanel.guess() and its map property.
>>>>> 
>>>>> I recently ran into this problem when attempting to use a GridPanel
>>>>> configured with a FeatureStore and a FeatureSelectionModel. I'm sure
>>>>> other
>>>>> components also have this issue. I solved it by manually binding the
>>>>> FeatureStore and FeatureSelectionModel in an 'afterrender' listener for
>>>>> the
>>>>> MapPanel.
>>>> Would that solve the issue if these components could be optionally be
>>>> configured with a Map or a MapPanel?
>>>> 
>>>> -- 
>>>> Eric Lemoine
>>>> 
>>>> Camptocamp France SAS
>>>> Savoie Technolac, BP 352
>>>> 73377 Le Bourget du Lac, Cedex
>>>> 
>>>> Tel : 00 33 4 79 44 44 96
>>>> Mail : [email protected]
>>>> http://www.camptocamp.com
>>>> 
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://www.geoext.org/cgi-bin/mailman/listinfo/dev
>>> 
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://www.geoext.org/cgi-bin/mailman/listinfo/dev
> 
> 
> -- 
> Alexandre Dubé
> Mapgears
> www.mapgears.com
> 
> _______________________________________________
> Dev mailing list
> [email protected]
> http://www.geoext.org/cgi-bin/mailman/listinfo/dev



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.

_______________________________________________
Dev mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/dev

Reply via email to