]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/browse.js
Reload the object list when the data browser is reopened
[rails.git] / app / assets / javascripts / index / browse.js
index e04a864f468c74e1f5d7ce58e53022c4b91780e7..49090f69cfe1a3a0b3742867d2bdb4d224e3cdca 100644 (file)
@@ -62,6 +62,8 @@ function initializeBrowse(map) {
 
     openSidebar();
 
+    if (browseObjectList) loadObjectList();
+
     map.on("moveend", updateData);
     updateData();
 
@@ -136,6 +138,8 @@ function initializeBrowse(map) {
     $("#browse_content").append(div);
   }
 
+  var dataLoader;
+
   function getData() {
     var bounds = locationFilter.isEnabled() ? locationFilter.getBounds() : map.getBounds();
     var size = bounds.getSize();
@@ -164,7 +168,9 @@ function initializeBrowse(map) {
       }
     @*/
 
-    $.ajax({
+    if (dataLoader) dataLoader.abort();
+
+    dataLoader = $.ajax({
       url: url,
       success: function (xml) {
         clearStatus();
@@ -203,6 +209,8 @@ function initializeBrowse(map) {
         } else {
           displayFeatureWarning(features.length, maxFeatures, addFeatures);
         }
+
+        dataLoader = null;
       }
     });
   }