Matt, Thank you for the detailed answer. It will be looking at it, with some wrinkling of the brow, next week, and will post my results.
Ralph Dell, GISP GIS Dept. Catawba County, NC From: Matt Priour [mailto:[email protected]] Sent: Friday, March 26, 2010 3:29 PM To: Ralph Dell; [email protected] Subject: Re: [Users] layer tree configuration question I can tell you from a lot of trial & error, that the 'children' property of any gx_layerXXX nodetype are not evaluated. BaselayerContainer, OverlaylayerContainer, ParamLayer all use loaders to populate their child node arrays. The best you can do with either of these 3 node types is to set a 'baseParams' property which will need get applied as part of the node config for each of the child nodes created by the loader. If you use gx_layer as the nodetype, then the childnodes do get evaluated. However, it also expects to find a layer property on the node and a matching layer in the layer store. If either of these conditions aren't met, errors will occur and your tree won't render or work correctly. You have a few options: 1. Be highly specific for the layer nodes you want to customize. Use 'async' & 'gx_layer' node types with the specific layer & attributes you wish to represent. You can use a 'gx_layer' node type as a group layer container node, but it must also have a matching layer in the layer store (I've never tried a dummy layer here but it might also work). 2. Use the 'gx_layerparam' or 'gx_overlaylayercontainer' node to create the tree and then modify the node ui after creation. In other words, write a function to find the layer you are interested in, access the associated node, access the node's nodeUI and change properties there (such as the iconCls, etc...) 3. I have created a custom node type (gx_complexlayer) that has similar node construction logic as the 'gx_layer' node type but doesn't expect a layer property and expects it's descendant nodes (at some level) to have a layer property. This was useful to me as it can contain both gx_layer nodes and other loader based nodes as well as using a loader itself if configured to do so. I've made a ticket for this functionality but not submitted a patch yet, because I 'haven't written test or an example for this node type yet and it will fail in some corner cases. I have attached it as a patch here if you want to use it with the understanding that it is certainly incomplete. Matt Priour Kestrel Computer Consulting From: Ralph Dell <mailto:[email protected]> Sent: Friday, March 26, 2010 1:32 PM To: [email protected] Subject: [Users] layer tree configuration question Thanks to the examples and previous forum posts I almost have my layer tree looking exactly as I would like. What I haven't been able to figure out is under a layer check box, (in this case Schools), I would like to display icons and text that would correspond to map symbology for different types of features in the given layer. I do not get anything displayed under the check box and have been unsuccessful in finding a solution. Any pointers or examples on how to accomplish that would be appreciated. I am pulling my layers from a group layer similar to Tasmania ( Group Layer) in the Tree Nodes example. Here is my json: var treeConfig = new OpenLayers.Format.JSON().write([ { nodeType: "gx_baselayercontainer", layer: 'Layers', isLeaf : false, loader: { param: "LAYERS" } },{ text: 'School Layers', expanded: true, children: [{ nodeType: "gx_layerparam", layer: 'Schools', param: "LAYERS", item: "catawba2:schools", text: 'Schools', expanded: true, children: [{ // under the Schools check box I want to display symbols and text that correspond text: 'Elementary Schools', // to the symbology that I use on the map IconCls: 'cc_elem' // nothing displays },{ // how can I add symbols and text here? text: 'Middle School Districts3', // I don't even know if using children: [{}] is the correct approach. iconCls: 'cc_middle' }] },{ nodeType: "gx_layerparam", layer: 'Schools', param: "LAYERS", item: "catawba2:elementary_school_districts", text: 'Elementary School Districts', iconCls: 'cc_elem_line', }] }], true); ________________________________ _______________________________________________ Users mailing list [email protected] http://www.geoext.org/cgi-bin/mailman/listinfo/users
_______________________________________________ Users mailing list [email protected] http://www.geoext.org/cgi-bin/mailman/listinfo/users
