[OpenLayers-Users] ExtJS 4 Class system and Openlayers

svranic.gf svranic at geof.hr
Wed Oct 9 04:14:37 PDT 2013


Hi everyone,
I am having problems with integrating Openlayers and ExtJS 4. I had no
problems with embeding map within ExtJS panel. I have troubles with
following features:
Feature info - I can catch map click and I get based on the coordinates data
in json format. Store, model and grid are configured correctly because it
works on a local json file. On a map click store should be reloaded. It
should probably be reloaded from click handler defined in a file where I
defined OL app and click event but I don't know how because of new class
system of ExtJS 4, i.e. how should I reference store and how should I call
.load() method

Tree panel - layer swithcher - with this one problem is following: Firebug
first reported that it cannot see variables layer1, layer2 and layer3. I
defined as global in my olApp.js file. Next, error occured that stated:
method setVisibility() is not defined. Question: How can I call any method
defined in Openlayers from ExtJS when using MVC architecture with new ExtJS
4 class system?

	Ext.define('app.view.LayerSwitcherTreePanel', {
		extend: 'Ext.tree.Panel',
		alias: 'widget.layerSwitcherTreePanel',
		title: 'Layers',
		listeners: {
			checkchange: function(node, check) {
				if (node.get('id') == 'layer1') {
					layer1.setVisibility(true);
					layer2.setVisibility(false);
					layer3.setVisibility(false);
				} else if (node.get('id') == 'layer2') {
					layer1.setVisibility(false);
					layer2.setVisibility(true);
					layer3.setVisibility(false);
				} else if (node.get('id') == 'layer3') {
					layer1.setVisibility(false);
					layer2.setVisibility(false);
					layer3.setVisibility(true);
				}
			}
		},
		root: {
			text:'All layers',
			expanded:true,
			children:[{
				text: 'Layer set 1',
				expanded: true,
				children: [{
					text: 'Layer 1',
					id: 'layer1',
					leaf: true,
					checked: true
				}, {
					text: 'Layer 2',
					id: 'layer2',
					leaf: true,
					checked: false
				}, {
					text: 'Layer 3',
					id: 'layer3',
					leaf: true,
					checked: false
				}]
			}, {
				text:'Layer set 2',
				expanded: true,
				children:[{
					text:'Layer xyz',
					id: 'layerxyz',
					leaf:true,
					checked: true
				}]
			}]
		}
	});


To summarize, I have a feeling that only problem with my application is
visibility of method and variables accross two JS frameworks.

I hope that everything I wrote is more or less clear. If not or if
additional code is required please let me know.

Cheers
Sasa



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/ExtJS-4-Class-system-and-Openlayers-tp5082576.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list