X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2FTemplate.js;h=121b46250882170a302555527274cb1adf904cb3;hb=6ad3cd3a05c8dd0b133db2e9149bb86801b9ef78;hp=b415e80e55e36d60046be21b52104a7911999f63;hpb=376df4906bc88a5bc987be0e17ae624bd63b2dac;p=roojs1 diff --git a/Roo/Template.js b/Roo/Template.js index b415e80e55..121b462508 100644 --- a/Roo/Template.js +++ b/Roo/Template.js @@ -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) {