Roo/Template.js
[roojs1] / Roo / Template.js
index b415e80..121b462 100644 (file)
@@ -44,7 +44,9 @@ Roo.Template = function(cfg){
         // bc
         this.html = cfg;
     }
-    
+    if (this.url) {
+        this.load();
+    }
     
 };
 Roo.Template.prototype = {
@@ -65,11 +67,7 @@ Roo.Template.prototype = {
     applyTemplate : function(values){
         try {
             _t= this;
-            if (this.url) {
-                this.afterLoad = function () { _t.applyTemplate(values); };
-                this.load();
-                return;
-            }
+          
             if(this.compiled){
                 return this.compiled(values);
             }
@@ -117,10 +115,11 @@ Roo.Template.prototype = {
         if (this.loading) {
             return;
         }
+        var _t = this;
         
         this.loading = true;
         this.compiled = false;
-        var _t = this;
+        
         var cx = new Roo.data.Connection();
         cx.request({
             url : this.url,
@@ -128,6 +127,7 @@ Roo.Template.prototype = {
             success : function (response) {
                 _t.loading = false;
                 _t.html = response.responseText;
+                _t.url = false;
                 _t.afterLoad && _t.afterLoad();
             },
             failure : function(response) {