title: jQuery reaching document.ready() despite .holdReady() call.  Slickgrid error - Slick is not defined (5 out of range 4) error - dependencies
body: <p>In the following script utilizing jQuery and slickGrid, I keep getting an error saying <code>Slick is not defined (5 out of range 4)</code> or <code>Slick is not defined (6 out of range 4)</code> - Both in FireBug, and in Chrome I get:</p>
  
  <pre><code>Uncaught ReferenceError: Slick is not defined
  $.ready.$.css.opacity
  f.Callbacks.o jquery-1.7.2.min.js.php:2
  f.Callbacks.p.add jquery-1.7.2.min.js.php:2
  e.fn.e.ready jquery-1.7.2.min.js.php:2
  (anonymous function)
  e.extend.globalEval jquery-1.7.2.min.js.php:2
  e.extend.globalEval jquery-1.7.2.min.js.php:2
  f.fn.extend.domManip jquery-1.7.2.min.js.php:4
  e.extend.each jquery-1.7.2.min.js.php:2
  f.fn.extend.domManip jquery-1.7.2.min.js.php:4
  f.fn.extend.append jquery-1.7.2.min.js.php:3
  f.fn.extend.html jquery-1.7.2.min.js.php:4
  e.extend.access jquery-1.7.2.min.js.php:2
  f.fn.extend.html jquery-1.7.2.min.js.php:4
  $.ajax.success AJAX.js:26
  f.Callbacks.o jquery-1.7.2.min.js.php:2
  f.Callbacks.p.fireWith jquery-1.7.2.min.js.php:2
  w jquery-1.7.2.min.js.php:4
  f.support.ajax.f.ajaxTransport.send.d jquery-1.7.2.min.js.php:4
  FBL.ns.handleStateChange
  </code></pre>
  
  <p>However, if I comment out <code>var grid = new Slick.Grid("#myGrid", data, columns, options);</code>, the script runs fine.  I have confirmed all the scripts are loading, going so far as to fire alerts in each one.  Also in Firebug/Chrome, I read the loaded scripts, and they appear correct.  Is there anything I could be overlooking?  The page code is as follows:</p>
  
  <pre><code>&lt;link type="text/css" rel="stylesheet" href="css/slick.grid.css" /&gt;
  &lt;link type="text/css" rel="stylesheet" href="css/surge.slickGrid.css" /&gt; 
  &lt;link type="text/css" rel="stylesheet" href="css/jquery.calendarPicker.css" /&gt;  
  &lt;link type="text/css" rel="stylesheet" href="css/cupertino/jquery-ui-1.8.20.custom.css" /&gt;
  
      &lt;div style="position:relative; overflow:visible; margin:25px 0 0 0;"&gt;
          &lt;div id="loader" style="position:absolute; z-index:997;top: 62px; left:200px;"&gt;&lt;img src="images/loading.gif" border="0" /&gt;&lt;/div&gt;
  
          &lt;div id="dateInput" style="visibility:hidden;"&gt;&lt;p&gt;&lt;label for="datepicker"&gt;Date: &lt;/label&gt;&lt;input type="text" id="datepicker" size="30"/&gt;&lt;/p&gt;
  
      &lt;/div&gt;
          &lt;div id="myGrid" style="width:900px;height:200px;visibility:hidden;"&gt;&lt;/div&gt; 
      &lt;/div&gt;
  
        &lt;div class="options-panel"&gt;
          &lt;h2&gt;Instructions:&lt;/h2&gt;
          &lt;ul&gt;
            &lt;li&gt;Select the date by clicking the date image above the table&lt;/li&gt;
            &lt;li&gt;Enter your event data (you can enter multiple events for that date)&lt;/li&gt;
            &lt;li&gt;To add another event, hit your &lt;em&gt;TAB&lt;/em&gt; key and a new row will be created&lt;/li&gt;
            &lt;li&gt;When you're all done for this date, click the &lt;em&gt;Commit Changes&lt;/em&gt; button to have your events saved to the site&lt;/li&gt;
          &lt;/ul&gt;
  
          &lt;h2&gt;Options:&lt;/h2&gt;
  
  &lt;button&gt;Commit Changes&lt;/button&gt;
        &lt;/div&gt;
  
  
  
  &lt;script type="text/javascript" src="js/jquery-ui-1.8.20.custom.min.js.php"&gt;&lt;/script&gt;
  &lt;script&gt;
  $.getScript("js/slickGrid/slick.grid.js");
      $.getScript("js/slickGrid/surge.core.js");
          $.getScript("js/slickGrid/surge.slickGrid.js"); 
              $.getScript("js/jquery.calendarPicker.js"); 
                  $.getScript("js/jquery.json-2.3.min.js");   
  
  
  &lt;/script&gt;
  
  &lt;? //Instantiate   slickGrid jQueryUI widget ?&gt;
  &lt;script&gt;
  $(document).ready(function(){
      alert('Ready');
      //======== if I comment the following line out, the script completes without error =======
      var grid = new Slick.Grid("#myGrid", data, columns, options);
  
  
      $(function() {
          $( "#datepicker" ).datepicker();
  
              $( "#datepicker" ).datepicker( "option", "showAnim", "clip" );
      });
  });
  
  $(document).ready(function() {
      //Hide loading image div and show loaded jQuery modules
     $('#loader').hide();
     $('#dateInput').css({opacity: 0.0, visibility: "visible"}).animate({opacity: 1.0},"slow");
     $('#myGrid').css({opacity: 0.0, visibility: "visible"}).animate({opacity: 1.0},"slow");
  
  });
  &lt;/script&gt;   
      &lt;hr /&gt;EOP
  </code></pre>
  
  <p><em><strong>Updated Script load sequence</em></strong></p>
  
  <pre><code>$.holdReady(true);
  $.getScript("js/slickGrid/jquery.event.drag-2.0.min.js",function(){
      $.getScript("js/slickGrid/slick.core.js",function(){
          $.getScript("js/slickGrid/slick.grid.js",function(){
              $.getScript("js/slickGrid/surge.core.js",function(){
                  $.getScript("js/slickGrid/surge.slickGrid.js",function(){
                      $.holdReady(false);
                      alert('Done Loading slicks'); 
                          var grid = new Slick.Grid("#myGrid", data, columns, options);
                          alert('After Grid created');
                          $('#myGrid').slickGrid({
                              forceFitColumns: true,
                              columns: [
                                  { id: "venue", name: "Venue", field: "f_venue"},
                                  { id: "eventName", name: "Event Name", field: "f_eventName" },
                                  { id: "time", name: "Time", field: "f_time" },
                                  { id: "pricing", name: "Pricing", field: "f_price" },
                                  { id: "visible", name: "Visible", field: "f_visible", width: 20 }
                              ],
                              data: [
                                { f_venue: "Finn's", f_eventName: "Roy Rogers", f_time: "9pm", f_price: "$10 before 10", f_visible: 1 },
                              ]
                          });
                          alert('after data population');
  
                          var json = $.toJSON( $('#myGrid').slickGrid('data'));
  
                      }).fail(function(jqxhr, settings, exception) {  document.write('FAILED: '+exception); });
              }).fail(function(jqxhr, settings, exception) {  document.write('FAILED: '+exception); });
          }).fail(function(jqxhr, settings, exception) {  document.write('FAILED: '+exception); });
      }).fail(function(jqxhr, settings, exception) {  document.write('FAILED: '+exception) });//console.log( textstatus );
  }).fail(function(jqxhr, settings, exception) {  document.write('FAILED: '+exception) });//console.log( textstatus );
  </code></pre>
  
  <p>I am trying to load a series of .js files that are dependent on the script preceding it having successfully finished loading.  Thus, I'm using <code>.getScript()</code> (I am open to ANY other ideas, cause this is getting difficult to troubleshoot) to load the script, on success it loads the next or echos error to the screen, and this repeats until the last script, which should then display the grid and allow the <code>$(document).ready()</code> event to fire.  Problem is, neither of these things happen.  The <code>$.holdReady()</code> appears to do nothing, and while the alert('done loading slicks') fires properly, and web developer console reports no more errors, and scripts loading in the sequence I want, the grid isn't displaying, and the <code>$(document).ready()</code> event fires as though the <code>$.holdReady()</code> wasn't even there.  Any further insight into this implementation would help.  I know requireJS is built for exactly this (dependencies), but I really cannot figure out how to utilize it properly in this context. </p>
  
  <p><em><strong>UPDATE - All Working Now Except <code>$.holdReady()</code></em></strong></p>
  
  <p>All working now except the <code>.holdReady()</code>.  I've made that a moot point by instantiating the grid at the center of the nest, so it only runs when all scripts have completed successfully.  Works good, and lighter weight than requireJS..  Although.<code>getScript()</code> will not cache and will ALWAYS reload the file from the server.  Could relace those calls with <code>$.ajax()</code> calls and enable caching for a pretty big performance increase on files you don't change often.</p>
  
  <p>I'm posting the final nested script in case some people are having trouble getting slickGrid working for them (the documentation SUCKS for such a great product!).</p>
  
  <pre><code>&lt;script&gt;$.holdReady(true);&lt;/script&gt;  
  &lt;script  type="text/javascript" language="javascript" src="js/slickGrid/lib/firebugx.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/jquery-ui-1.8.20.custom.min.js.php"&gt;&lt;/script&gt;
  &lt;script src="js/slickGrid/plugins/slick.cellrangedecorator.js"&gt;&lt;/script&gt;
  &lt;script src="js/slickGrid/plugins/slick.cellrangeselector.js"&gt;&lt;/script&gt;
  &lt;script src="js/slickGrid/plugins/slick.cellselectionmodel.js"&gt;&lt;/script&gt;
  &lt;script src="js/slickGrid/slick.formatters.js"&gt;&lt;/script&gt;
  &lt;script src="js/slickGrid/slick.editors.js"&gt;&lt;/script&gt;
  
  &lt;script&gt;
  
      $.getScript("js/slickGrid/jquery.event.drag-2.0.min.js",function(){
          $.getScript("js/slickGrid/slick.core.js",function(){
              $.getScript("js/slickGrid/slick.grid.js",function(){
  
                          $.holdReady(false);
                          var grid;
  
                          var columns = [
                          { id: "VisitDate", name: "VisitDate", field: "VisitDate", width: 120, cssClass: "cell-title", editor: Slick.Editors.Text },
                          { id: "VisitTime", name: "VisitTime", field: "VisitTime", width: 100, editor: Slick.Editors.Text },
                          { id: "PrimaryComplaint", name: "PrimaryComplaint", field: "PrimaryComplaint", width: 100, cssClass: "cell-right", editor: Slick.Editors.Text },
                          ];
  
                          var data = [
                              {
                              "VisitDate": "11/30/2009",
                              "VisitTime": "0117",
                              "PrimaryComplaint": "General malaise "
                              },
                              {
                              "VisitDate": "02/08/2010",
                              "VisitTime": "0930",
                              "PrimaryComplaint": "General malaise "
                              }
                          ];
  
                          var options = {
                          editable: true,
                          enableAddRow: true,
                          enableCellNavigation: true,
                          asyncEditorLoading: false,
                          forceFitColumns: true
                          };
  
                          // grid = new Slick.Grid($("#acs-work"), returnObj.source, columns, options);
                          //var $tabs = $('#tabset').tabs();
                          //var selected = $tabs.tabs('option', 'selected') + 1; // =&gt; 0[edit]
                          //var panelstr = "#panel" + selected;
                          //to load dynamic data
                          // PROTO: grid = new Slick.Grid($(panelstr), returnObj.source, columns, options); 
                          grid = new Slick.Grid("#myGrid", data, columns, options); 
  
  
  
                              $('#loader').hide();
                             $('#dateInput').css({opacity: 0.0, visibility: "visible"}).animate({opacity: 1.0},"slow");
                             $('#myGrid').css({opacity: 0.0, visibility: "visible"}).animate({opacity: 1.0},"slow");
  
              }).fail(function(jqxhr, settings, exception) {  document.write('FAILED: '+exception); });
          }).fail(function(jqxhr, settings, exception) {  document.write('FAILED: '+exception) });//console.log( textstatus );
      }).fail(function(jqxhr, settings, exception) {  document.write('FAILED: '+exception) });//console.log( textstatus );
  </code></pre>