[Users] Adding a Node After A Tree Has Been Created

IT Intern itintern12 at gmail.com
Wed Nov 24 17:45:34 CET 2010

Hello GeoExt/ExtJS list,

I am just having trouble with one thing after another.  I have a layer that
I create after my tree panel has been created ( I have my reasons, getting
the map's extent of the viewport returns null if I try to use getExtent()
before the viewport has been created and I need getExtent() as parameters to
create this new layer.  So what I have done is created a layerNode that I
want to add to a container for this layer.  However this node does not take
the form of a radio button, which I believe it should, nor does it match up
to serve functionality to toggle the layer on and off, instead it throws an
error in firebug:

this.node.getOwnerTree() is null
var checkedNodes = this.node.getOwnerTree().getChecked();

Line 84

//function to create the original child overlay container with radio buttons

function childContainerRadioButtons(text, layerStore, parent, iconCls){

    parent.appendChild(new GeoExt.tree.OverlayLayerContainer({
        text: text,
        layerStore: layerStore,
        expanded: true,
        iconCls: iconCls,  //If not specified, defaults to original image
                checkedGroup: "foo"

}//end childContainerRadioButtons

//TreePanel code

//Tree menu for layers
            var layerTree = new Ext.tree.TreePanel({
                overflow: 'visible',     // For the Combo popup
                region: "west",
                title: "Map Layers",
                root: layerRoot,
                loader: new Ext.tree.TreeLoader({applyLoader: false}),
                enableDD: true,
                collapsible: true,
                width: 300,
                autoScroll: true,
                expanded: false

//The node I want to add to that child overlay container

layerStore.loadData([vectorPano], true);  //adding layer to the layerstore
of that container
        var layerContainer = layerRoot.findChild('text', 'Photo Layers');
        layerContainer.appendChild(new GeoExt.tree.LayerNode({
            leaf: true,
            text: 'Panoramio Photos',
            layer: vectorPano,
            layerStore: layerStore,
            loader: {baseAttrs: {checkedGroup: "foo"}},  //This node is the
odd one out, rendering a checkbox while it siblings are radio buttons
            checked: false

I've been stuck for a while, any hints would be greatly appreciated.  I
thought I'd be able to get it on my own if I had the other issues resolved
(asked recently) and I apologize for asking all the questions.  I'm just
having a hard time :-/

Thanks in advance for your continuous kind help :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101124/1a41ccbc/attachment.htm 

More information about the Users mailing list