add support for onLoad on template
authorAlan Knowles <alan@roojs.com>
Thu, 4 Mar 2021 07:50:41 +0000 (15:50 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 4 Mar 2021 07:50:41 +0000 (15:50 +0800)
Roo/Template.js
roojs-all.js
roojs-core-debug.js
roojs-core.js
roojs-debug.js

index 8d21e6b..586a7de 100644 (file)
@@ -137,7 +137,7 @@ Roo.Template.prototype = {
                 _t.url = false;
                 _t.compile();
                 if (_t.onLoad) {
-                    _t.onload();
+                    _t.onLoad();
                 }
              },
             failure : function(response) {
index 0fa1253..38a8f80 100644 (file)
@@ -216,7 +216,7 @@ el.appendChild(N);}else{var O=E(o);N=this.insertHtml("beforeEnd",el,O);}return M
 Roo.Template=function(A){if(A instanceof Array){A=A.join("");}else if(arguments.length>1){A=Array.prototype.join.call(arguments,"");}if(typeof(A)=='object'){Roo.apply(this,A)}else{this.html=A;}if(this.url){this.load();}};Roo.Template.prototype={onLoad:false,url:false,html:'',applyTemplate:function(A){try{if(this.compiled){return this.compiled(A);
 }var B=this.disableFormats!==true;var fm=Roo.util.Format,C=this;var fn=function(m,D,E,F){if(E&&B){if(E.substr(0,5)=="this."){return C.call(E.substr(5),A[D],A);}else{if(F){var re=/^\s*['"](.*)["']\s*$/;F=F.split(',');for(var i=0,G=F.length;i<G;i++){F[i]=F[i].replace(re,"$1");
 }F=[A[D]].concat(F);}else{F=[A[D]];}return fm[E].apply(fm,F);}}else{return A[D]!==undefined?A[D]:"";}};return this.html.replace(this.re,fn);}catch(e){Roo.log(e);throw e;}},loading:false,load:function(){if(this.loading){return;}var _t=this;this.loading=true;
-this.compiled=false;var cx=new Roo.data.Connection();cx.request({url:this.url,method:'GET',success:function(A){_t.loading=false;_t.html=A.responseText;_t.url=false;_t.compile();if(_t.onLoad){_t.onload();}},failure:function(A){Roo.log("Template failed to load from "+_t.url);
+this.compiled=false;var cx=new Roo.data.Connection();cx.request({url:this.url,method:'GET',success:function(A){_t.loading=false;_t.html=A.responseText;_t.url=false;_t.compile();if(_t.onLoad){_t.onLoad();}},failure:function(A){Roo.log("Template failed to load from "+_t.url);
 _t.loading=false;}});},set:function(A,B){this.html=A;this.compiled=null;if(B){this.compile();}return this;},disableFormats:false,re:/\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,compile:function(){var fm=Roo.util.Format;var A=this.disableFormats!==true;var B=Roo.isGecko?"+":",";
 var fn=function(m,D,E,F){if(E&&A){F=F?','+F:"";if(E.substr(0,5)!="this."){E="fm."+E+'(';}else{E='this.call("'+E.substr(5)+'", ';F=", values";}}else{F='';E="(values['"+D+"'] == undefined ? '' : ";}return "'"+B+E+"values['"+D+"']"+F+")"+B+"'";};var C;if(Roo.isGecko){C="this.compiled = function(values){ return '"+this.html.replace(/\\/g,'\\\\').replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};";
 }else{C=["this.compiled = function(values){ return ['"];C.push(this.html.replace(/\\/g,'\\\\').replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));C.push("'].join('');};");C=C.join('');}eval(C);return this;},call:function(A,B,C){return this[A](B,C);
index c47dca8..0f5667c 100644 (file)
@@ -4762,7 +4762,7 @@ Roo.Template.prototype = {
                 _t.url = false;
                 _t.compile();
                 if (_t.onLoad) {
-                    _t.onload();
+                    _t.onLoad();
                 }
              },
             failure : function(response) {
index a6b0d11..c89e95b 100644 (file)
@@ -216,7 +216,7 @@ el.appendChild(N);}else{var O=E(o);N=this.insertHtml("beforeEnd",el,O);}return M
 Roo.Template=function(A){if(A instanceof Array){A=A.join("");}else if(arguments.length>1){A=Array.prototype.join.call(arguments,"");}if(typeof(A)=='object'){Roo.apply(this,A)}else{this.html=A;}if(this.url){this.load();}};Roo.Template.prototype={onLoad:false,url:false,html:'',applyTemplate:function(A){try{if(this.compiled){return this.compiled(A);
 }var B=this.disableFormats!==true;var fm=Roo.util.Format,C=this;var fn=function(m,D,E,F){if(E&&B){if(E.substr(0,5)=="this."){return C.call(E.substr(5),A[D],A);}else{if(F){var re=/^\s*['"](.*)["']\s*$/;F=F.split(',');for(var i=0,G=F.length;i<G;i++){F[i]=F[i].replace(re,"$1");
 }F=[A[D]].concat(F);}else{F=[A[D]];}return fm[E].apply(fm,F);}}else{return A[D]!==undefined?A[D]:"";}};return this.html.replace(this.re,fn);}catch(e){Roo.log(e);throw e;}},loading:false,load:function(){if(this.loading){return;}var _t=this;this.loading=true;
-this.compiled=false;var cx=new Roo.data.Connection();cx.request({url:this.url,method:'GET',success:function(A){_t.loading=false;_t.html=A.responseText;_t.url=false;_t.compile();if(_t.onLoad){_t.onload();}},failure:function(A){Roo.log("Template failed to load from "+_t.url);
+this.compiled=false;var cx=new Roo.data.Connection();cx.request({url:this.url,method:'GET',success:function(A){_t.loading=false;_t.html=A.responseText;_t.url=false;_t.compile();if(_t.onLoad){_t.onLoad();}},failure:function(A){Roo.log("Template failed to load from "+_t.url);
 _t.loading=false;}});},set:function(A,B){this.html=A;this.compiled=null;if(B){this.compile();}return this;},disableFormats:false,re:/\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,compile:function(){var fm=Roo.util.Format;var A=this.disableFormats!==true;var B=Roo.isGecko?"+":",";
 var fn=function(m,D,E,F){if(E&&A){F=F?','+F:"";if(E.substr(0,5)!="this."){E="fm."+E+'(';}else{E='this.call("'+E.substr(5)+'", ';F=", values";}}else{F='';E="(values['"+D+"'] == undefined ? '' : ";}return "'"+B+E+"values['"+D+"']"+F+")"+B+"'";};var C;if(Roo.isGecko){C="this.compiled = function(values){ return '"+this.html.replace(/\\/g,'\\\\').replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};";
 }else{C=["this.compiled = function(values){ return ['"];C.push(this.html.replace(/\\/g,'\\\\').replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));C.push("'].join('');};");C=C.join('');}eval(C);return this;},call:function(A,B,C){return this[A](B,C);
index 6abd31e..fb819f7 100644 (file)
@@ -4762,7 +4762,7 @@ Roo.Template.prototype = {
                 _t.url = false;
                 _t.compile();
                 if (_t.onLoad) {
-                    _t.onload();
+                    _t.onLoad();
                 }
              },
             failure : function(response) {