[OpenLayers-Users] ExtJS 4 Class system and Openlayers
Meine Toonen
meinetoonen at b3partners.nl
Wed Oct 9 05:05:26 PDT 2013
Hi,
I think this belongs more to the sencha forums, but here it goes.
For the feature info:
When creating the grid for the featureinfo you can do something like this:
var grid = Ext.create(Ext.grid.Panel, {/* options */ });
When loading new data, you reference the grid variable:
var store = grid.getStore();
store.load();
For the treepanel:
I don't know if this has to do with the new class system, but for the listener to be aware of the global scope, you have to set this. Like:
listeners: {
checkchange: function(node, check) {
},
scope:this
}
You can also look up the nodes itself, instead of setting them as globals. Explanation here: http://stackoverflow.com/questions/13139150/select-treepanel-node-by-id
I don't know why .setVisiblity() is undefined for layer1,layer2, etc. For that I have to know how you store them (and thus what kind of object they are).
You problems have little to nothing to do with openlayers, and more with extjs.
I hope that helps!
Kind regards!
Met vriendelijke groet,
Meine Toonen
B3Partners BV
Tel: 030 214 2083
_____
From: svranic.gf [mailto:svranic at geof.hr]
To: openlayers-users at lists.osgeo.org
Sent: Wed, 09 Oct 2013 13:14:37 +0100
Subject: [OpenLayers-Users] ExtJS 4 Class system and Openlayers
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.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20131009/ba2f949b/attachment.html>
More information about the Users
mailing list