d4de98df3ebe5f748f993984acc55747a08c9f51
tdreszer
  Mon Nov 15 09:11:00 2010 -0800
Support for AJAX callback at initial load to retrieve individual tracks.  This is useful if a track has a remote data source and will take a long time to retrieve, then draw the image.
diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index f119b2e..ddf7dd7 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -1288,30 +1288,39 @@
                 }
             });
         }
         if(imgBoxPortal) {
             //warn("imgBox("+imgBoxChromStart+"-"+imgBoxChromEnd+","+imgBoxWidth+") bases/pix:"+imgBoxBasesPerPixel+"\nportal("+imgBoxPortalStart+"-"+imgBoxPortalEnd+","+imgBoxPortalWidth+") offset:"+imgBoxPortalOffsetX);
 
             // Turn on drag scrolling.
             $("div.scroller").panImages(imgBoxPortalOffsetX,imgBoxLeftLabel);
         }
         //$("#zoomSlider").slider({ min: -4, max: 3, step: 1 });//, handle: '.ui-slider-handle' });
 
         // Temporary warning while new imageV2 code is being worked through
         if($('#map').children("AREA").length > 0) {
             warn('Using imageV2, but old map is not empty!');
         }
+
+        // Retrieve tracks via AJAX that may take too long to draw initialliy (i.e. a remote bigWig)
+        var retrievables = $('#imgTbl').find("tr.mustRetrieve")
+        if($(retrievables).length > 0) {
+            $(retrievables).each( function (i) {
+                var trackName = $(this).attr('id').substring(3);
+                updateTrackImg(trackName,"","");
+            });
+        }
     }
     if($('img#chrom').length == 1) {
         if($('.cytoBand').length > 1) {
             $('img#chrom').chromDrag();
         }
     }
 
     if($("#tabs").length > 0) {
         // Search page specific code
 
         var val = $('#currentTab').val();
         $("#tabs").tabs({
                             show: function(event, ui) {
                                 $('#currentTab').val(ui.panel.id);
                             },
@@ -2505,15 +2514,16 @@
                 if(typeof(disabled[val]) == 'undefined')
                     span.html("<a target='_blank' title='detailed descriptions of terms' href='" + str + "'>" + text + "</a>");
                 else
                     span.empty();
             }
         } else {
             return;
         }
     }
 }
 
 function windowOpenFailedMsg()
 {
     alert("Your web browser prevented us from opening a new window.\n\nYou need to change your browser settings to allow popups from " + document.domain);
 }
+
\ No newline at end of file