- When the selected event is triggered, the underlying feature attributes are shown on the right.
+ When the selected event is triggered, the underlying feature attributes are shown below.
@@ -74,36 +76,33 @@
/*
* Controls
*/
- var callback = function(attributes) {
- if (attributes) {
- var msg = "In 2005, " + attributes.NAME
- msg += " had a population of " + attributes.POP2005 + " people.";
- var element = OpenLayers.Util.getElement('attrsdiv');
- element.innerHTML = msg;
- return true;
- } else {
- this.element.innerHTML = '';
- return false;
+ var callback = function(dataLookup) {
+ var msg = "";
+ if (dataLookup) {
+ var data;
+ for (var idx in dataLookup) {
+ // idx can be used to retrieve layer from map.layers[idx]
+ data = dataLookup[idx];
+ msg += "In 2005, " + data.NAME + " had a population of " +
+ data.POP2005 + " people. ";
+ }
}
+ document.getElementById("attrsdiv").innerHTML = msg;
};
var controls = {
move: new OpenLayers.Control.UTFGrid({
- div: 'attrsdiv',
+ callback: callback,
handlerMode: 'move'
}),
hover: new OpenLayers.Control.UTFGrid({
- div: 'attrsdiv',
+ callback: callback,
handlerMode: 'hover'
}),
click: new OpenLayers.Control.UTFGrid({
- div: 'attrsdiv',
+ callback: callback,
handlerMode: 'click'
- }),
- click_callback: new OpenLayers.Control.UTFGrid({
- handlerMode: 'click',
- callback: callback
- }),
+ })
};
var control;
for(var key in controls) {
diff --git a/examples/utfgrid_twogrids.html b/examples/utfgrid_twogrids.html
index e62ef063f2..de3bf84ae2 100644
--- a/examples/utfgrid_twogrids.html
+++ b/examples/utfgrid_twogrids.html
@@ -8,37 +8,34 @@
OpenLayers Multiple UTFGrid Demo
-
-
- This page demonstrates the use of the OpenLayers UTFGrid Controls with more than one UTFGrid Layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ This page demonstrates the use of the OpenLayers UTFGrid Controls with more than one UTFGrid Layer.