← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13392: gis event info window positioning improved

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 13392 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-23 09:22:56 +0100
message:
  gis event info window positioning improved
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2013-12-22 23:27:34 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2013-12-23 08:00:34 +0000
@@ -538,7 +538,8 @@
                     attributes = feature.attributes,
                     map = attributes.nameColumnMap,
                     html = '<table>',
-                    titleStyle = ' style="font-weight:bold; padding-right:10px"';
+                    titleStyle = ' style="font-weight:bold; padding-right:10px"',
+                    windowPosition;
 
                 // default properties
                 html += '<tr><td' + titleStyle + '>' + map['ou'] + '</td><td>' + attributes['ouname'] + '</td></tr>';
@@ -555,18 +556,31 @@
                 html += '</table>';
 
                 if (Ext.isObject(eventWindow) && eventWindow.destroy) {
+                    windowPosition = eventWindow.getPosition();
                     eventWindow.destroy();
+                    eventWindow = null;
                 }
 
                 eventWindow = Ext.create('Ext.window.Window', {
                     title: 'Event',
                     resizable: false,
                     bodyStyle: 'background-color:#fff; padding:5px',
-                    html: html
+                    html: html,
+                    autoShow: true,
+                    listeners: {
+                        show: function(w) {
+                            if (windowPosition) {
+                                w.setPosition(windowPosition);
+                            }
+                            else {
+                                gis.util.gui.window.setPositionTopRight(w);
+                            }
+                        },
+                        destroy: function() {
+                            eventWindow = null;
+                        }
+                    }
                 });
-
-                eventWindow.show();
-                gis.util.gui.window.setPositionTopRight(eventWindow);
             };
 		}