[Users] GeoExt.tree problem

Robert Buckley robertdbuckley at yahoo.com
Mon Jul 11 07:11:34 CEST 2011


Hi,

I would be very interested in seeing all of the code for the project, if you 
don´t mind of course.

I am also having various problems with tree structures and understanding how the 
code works and find the examples from other projects very useful,

Either a link to the project online or pasted code would be great,

Yours,

Rob




________________________________
Von: brad <brad at numaps.com.au>
An: brad <brad at numaps.com.au>; Andreas Hocevar <ahocevar at opengeo.org>
CC: users at geoext.org
Gesendet: Montag, den 11. Juli 2011, 2:13:15 Uhr
Betreff: Re: [Users] GeoExt.tree problem

Sorted!

Well just in case anyone else wants to do this ......

Instead of using Ext.get(layer.name).setIconCls('loading'); in my loadstart
event, I used

controlPanels.tree.getNodeById(layer.name).setIconCls('loading');

You just have to check that the tree node has been opened before using it.

Thanks Andreas you got me on the right track!

Cheers,

Brad....

-----Original Message-----
From: users-bounces at geoext.org [mailto:users-bounces at geoext.org] On Behalf
Of brad
Sent: Monday, 11 July 2011 1:08 AM
To: 'Andreas Hocevar'
Cc: users at geoext.org
Subject: Re: [Users] GeoExt.tree problem

Andreas,

Still not quite there mate!

I noticed that Ext 3.2.1 did not support setIconCls so had to load Ext
3.3.1. I have been able to get the setIconCls to work. But I am a little
confused as to what goes where.

This is my listener that is on the tree - it passes the tree node object
thru to the listener. 

"checkchange": function(node){setTheForecastLayers(node)

Within this listener I can change the icon class simply by doing
node.setIconClass('loading'). That proved that if I have the node object I
can change its image class. Obviously that is not what I want - that was
just a test. 

When I load the layer I register the loading events with the following where
layer is the layer object created in OL.

// ----- layer loading events ----- //
function registerEvents(layer) 
{        
    if(layer.name != '' && layer.name != null && !layer.isBaseLayer)
    {
        layer.events.register("loadstart",  layer,  function() 
        {
            if (layersLoading == 0) 
            {    
                eventsLog.style.display='block';  
            }
            layersLoading++;
        });
        layer.events.register("loadend",  layer,  function() 
        {
            layersLoading--;
            if (layersLoading == 0) 
            {    
                eventsLog.style.display='none';
            }
        });
    }
} 

The problem I have is how to change the iconCls of the node. I thought that
if I made the id of the node the same as the layer.name of the layer that I
could do the following inside these events instead of the changing the
display of the all layers loading icon 'eventsLog'. 

Ext.get(layer.name).setIconCls('loading');

However, the error I get is that Ext.get(layer.name) is null yet I know that
the node has the correct id as I can alert that in the checkbox listener.

So I must be doing something wrong here? Any ideas?

Cheers, Brad....











-----Original Message-----
From: Andreas Hocevar [mailto:ahocevar at opengeo.org] 
Sent: Friday, 8 July 2011 8:21 PM
To: brad
Cc: users at geoext.org
Subject: Re: [Users] GeoExt.tree problem

Hi,

the Ext.tree.TreeNode has a setIconCls method. This should get you there.

Andreas.

On Fri, Jul 8, 2011 at 12:00 PM, brad <brad at numaps.com.au> wrote:
> Andreas,
>
> Ok I understand. I currently have a loader wheel running using
> loadstart/loadend but I would like to control the icon at the tree node. I
> have found that you can change the default image at the node level with
> iconCls: 'my image class'. However, I can't figure out how to change the
> className under program control.
>
> For example, I can place a listener on the treePanel which allows me to
> interrogate the node selected ('checkchange':function(node)(...)) whenever
a
> checkbox is clicked. However, inside this function when I look at the
node's
> iconCls its 'undefined' and yet there is an iconCls set for each node in
the
> tree - either the default one or one that I set. So without access to the
> iconCls for a node I can't see how I can use the loadstart/Loadend to
> control the node's image className?
>
> There must be something I'm missing here???
>
> Cheers, Brad....
>
> -----Original Message-----
> From: andreas.hocevar at gmail.com [mailto:andreas.hocevar at gmail.com] On
Behalf
> Of Andreas Hocevar
> Sent: Friday, 8 July 2011 5:15 PM
> To: brad
> Cc: users at geoext.org
> Subject: Re: [Users] GeoExt.tree problem
>
> Hi,
>
> there is no way to get this loading throbber with just GeoExt. The
> JSON tree loader in GeoExt has this throbber, spinning until the JSON
> response is turned into layer nodes.
>
> It is, however, possible to achieve this on the application level by
> registering for the OpenLayers Map's loadstart and loadend events.
>
> Andreas.
>
> On Fri, Jul 8, 2011 at 7:50 AM, brad <brad at numaps.com.au> wrote:
>> List,
>>
>>
>>
>> I have seen GeoExt apps that have a small animated gif spin on the layer
>> nodes. I cannot see how to activate this. The examples also do not have
>> spinning layer load wheels? Is there something i need to configure to get
>> this load wheel operating.
>>
>>
>>
>> My nodes look like this:
>>
>>
>>
>> nodeType: "gx_layer",
>>
>>                 layer      : “layer 1”,
>>
>>                 text        : “my layer name”,
>>
>>                 isLeaf    : true,
>>
>>                 disabled : false
>>
>>
>>
>> Cheers,
>>
>>
>>
>> Brad....
>>
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>
>>
>
>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
>
>



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


_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110711/c59d1a59/attachment-0001.htm 


More information about the Users mailing list