Discussion:
[Users] Using GeoEXT2 store for Layer tree
Shahid Nawaz Khan
2017-03-01 17:23:57 UTC
Permalink
*I want to create a layer tree like the one given in the below example*.
https://iris.gov.gr/SoilServices/danger.html

The example finely works when i implement the same on my own system it
doesn't work and I don't know much about the complexities of GeoEXT.

I am writing my code here below and the error that I get.

Here is the code for the Store:

var store = Ext.create('Ext.data.TreeStore', {

model: 'GeoExt.data.LayerTreeModel',

root: {

text: "Root",

expanded: true,

children: [

{

text: "ΘεΌατικοί Χάρτες",

leaf: false,

expanded: true,

children: [

{

text: sppsq.name,

layer: sppsq,

leaf: true,

checked: false,

children: [],

nodeType: "gx_overlaylayercontainer"

},

{

text: elecag.name,

layer: elecag,

leaf: true,

checked: false,

children: [],

nodeType: "gx_overlaylayercontainer"

},

]

},

{

plugins: [{

ptype: 'gx_baselayercontainer',

loader: {store: mapPanel.layers} // BASE "REFERENCE" LAYERS FROM
arcticMapPanel

}],

expanded: true,

text: 'ΥπόβαΞρα'

}

]

}

});

Below is the code for tree:

var tree = Ext.create('GeoExt.tree.Panel', {

border: true,

region: "west",

title: "ΕπίπεΎα",

width: 290,

split: true,

collapsible: true,

collapseMode: "mini",

autoScroll: true,

store: store,

rootVisible: false,

lines: false,

listeners: {

checkchange: {

fn: function (record, checked, opts) {

record.data.layer.setVisibility(checked)

}

}

}

}

);

Error Got:

I get the following error in the console.
too much recursion
http://cdn.sencha.com/ext/gpl/5.1.0/build/ext-all-debug.js
Line 1759

*Help Required:*
Any help will be appreciated as I am not an expert user of GeoEXT.
Christian Mayer | meggsimum
2017-03-02 11:20:40 UTC
Permalink
Hi Shahid,

I guess your 'checkchange'-handler is the problem. The GeoExt-tree takes
care of toggling the visibility of the corresponding layer of your
tree-node. It seems that you are doing the same in your
'checkchange'-handler, so the handlers call each other, which ends up in
an endless recursion.

Try to remove your own handler and let GeoExt handle the
visibility-toggle for you.

Cheers
Chris
Post by Shahid Nawaz Khan
*I want to create a layer tree like the one given in the below example*.
https://iris.gov.gr/SoilServices/danger.html
The example finely works when i implement the same on my own system it
doesn't work and I don't know much about the complexities of GeoEXT.
I am writing my code here below and the error that I get.
var store = Ext.create('Ext.data.TreeStore', {
model: 'GeoExt.data.LayerTreeModel',
root: {
text: "Root",
expanded: true,
children: [
{
text: "Θεματικοί Χάρτες",
leaf: false,
expanded: true,
children: [
{
text: sppsq.name <http://sppsq.name>,
layer: sppsq,
leaf: true,
checked: false,
children: [],
nodeType: "gx_overlaylayercontainer"
},
{
text: elecag.name <http://elecag.name>,
layer: elecag,
leaf: true,
checked: false,
children: [],
nodeType: "gx_overlaylayercontainer"
},
]
},
{
plugins: [{
ptype: 'gx_baselayercontainer',
loader: {store: mapPanel.layers} // BASE "REFERENCE" LAYERS
FROM arcticMapPanel
}],
expanded: true,
text: 'Υπόβαθρα'
}
]
}
});
var tree = Ext.create('GeoExt.tree.Panel', {
border: true,
region: "west",
title: "Επίπεδα",
width: 290,
split: true,
collapsible: true,
collapseMode: "mini",
autoScroll: true,
store: store,
rootVisible: false,
lines: false,
listeners: {
checkchange: {
fn: function (record, checked, opts) {
record.data.layer.setVisibility(checked)
}
}
}
}
);
I get the following error in the console.
too much recursion
http://cdn.sencha.com/ext/gpl/5.1.0/build/ext-all-debug.js
Line 1759
*Help Required:*
Any help will be appreciated as I am not an expert user of GeoEXT.
*
*
_______________________________________________
Users mailing list
http://www.geoext.org/cgi-bin/mailman/listinfo/users
Loading...