Roo/Template.js
[roojs1] / Roo / Template.js
index 8e28fd8..ea096de 100644 (file)
@@ -100,17 +100,31 @@ Roo.Template.prototype = {
     
     loading : false,
     
+    afterLoad : false,
+    
     load : function (url, success)
     {
+        
+        this.afterLoad = success;
         if (this.loading) {
-            return false;
+            return;
         }
-        var cx = new Roo.data.Connection({
+        
+        this.loading = true;
+        this.compiled = false;
+        var _t = this;
+        var cx = new Roo.data.Connection();
+        cx.request({
             url : url,
             method : 'GET',
-            success : success,
-            failure : function() {
-                Roo.log("Template failed to load from " + url);  
+            success : function (response) {
+                _t.loading = false;
+                _t.html = response.responseText;
+                _t.afterLoad && _t.afterLoad();
+            },
+            failure : function(response) {
+                Roo.log("Template failed to load from " + url);
+                _t.loading = false;
             }
         });
     },