Roo/Template.js
[roojs1] / Roo / Template.js
index cd230b2..2f1e80f 100644 (file)
@@ -98,6 +98,31 @@ Roo.Template.prototype = {
          
     },
     
+    loading : false,
+    
+    load : function (url, success)
+    {
+        if (this.loading) {
+            return;
+        }
+        this.loading = true;
+        var _t = this;
+        var cx = new Roo.data.Connection();
+        cx.request({
+            url : url,
+            method : 'GET',
+            success : function (response) {
+                _t.loading = false;
+                _t.html = response.responseText;
+                success && success();
+            },
+            failure : function(response) {
+                Roo.log("Template failed to load from " + url);
+                _t.loading = false;
+            }
+        });
+    },
+
     /**
      * Sets the HTML used as the template and optionally compiles it.
      * @param {String} html