[Users] Customize treepanel
Hugo
hfpmartins at gmail.com
Thu Dec 9 15:31:04 CET 2010
Hi Antoni,
You can configure different layerstores and layercontainers and manually add
those to your tree panel. See the code below:
var baseLayerStore = new GeoExt.data.LayerStore({
map: map,
initDir: 0,
layers: [ghyb, gsat, gstreets]
});
var themeLayerStore = new GeoExt.data.LayerStore({
map: map,
initDir: 0,
layers: [lim_bac, lim_arht]
});
var baseLayerCont = new GeoExt.tree.BaseLayerContainer({
text: 'Cartografia de base',
layerStore: baseLayerStore,
expanded: true,
allowDrop: false
});
var themeLayerCont = new GeoExt.tree.LayerContainer({
text: 'Área de jurisdição da ARH Tejo',
expanded: true,
layerStore: themeLayerStore,
});
Now you just need to append the layercontainers into your tree root node
like the following
treeroot.appendChild(baseLayerCont);
treeroot.appendChild(themeLayerCont);
Hope this helps.
Best regards,
Hugo
On Thu, Dec 9, 2010 at 1:48 PM, Vidal, Antoni <antoni.vidal at icc.cat> wrote:
> Hello,
>
>
>
> I have a treepanel built by the following code in layout.js:
>
>
>
> items: [{
>
> title: 'Capes',
>
> xtype: "treepanel",
>
> loader: new Ext.tree.TreeLoader({
>
> applyLoader: false
>
> }),
>
> rootVisible: false,
>
> root: {
>
> children: createChildren()
>
> }
>
> }
>
>
>
> And:
>
>
>
> var createChildren = function(){
>
> return [{
>
> "nodeType":
> "gx_baselayercontainer",
>
> "expanded":
> true
>
> },{
>
> "nodeType":
> "gx_overlaylayercontainer",
>
> "expanded":
> false
>
> }]
>
> };
>
>
>
> I would like to customize the organisation in different folders and
> different order of layers, and not two folders “Base Layer” and “Overlays” which
> is what I get by default.
>
>
>
> How can I do ?
>
>
>
> Thank’s in advance
>
>
>
> *Antoni Vidal*
>
> Unitat d'Aplicacions SIG-WEB
> Institut Cartogràfic de Catalunya<http://mercuri.icc.cat/website/mob_nf/mob1/mob2/inici2.htm?CONSULTA=Institut%20Cartogr%25E0fic%20de%20Catalunya&XYADDRESS=429486:4580392>
> Parc de Montjuïc, E-08038 Barcelona
> Tel. (+34) 93 567 15 00 (ext. 3228)
> www.icc.cat
>
>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
>
--
Hugo Martins
LabNT - ISEGI UNL
Campus de Campolide
1070-312 Lisboa
N 38°43'56.84", W 9°9'35.74"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101209/9c729742/attachment-0001.htm
More information about the Users
mailing list