From 75224481127e047ebc1bf35a4abd7eee3eedec1c Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 4 Mar 2021 15:48:34 +0800 Subject: [PATCH] add support for onLoad on template --- docs/json/roodata.json | 24 ++++++++++++++++++++++++ docs/src/Roo_Template.js.html | 9 +++++++++ docs/symbols/Roo.DomTemplate.json | 7 +++++++ docs/symbols/Roo.MasterTemplate.json | 7 +++++++ docs/symbols/Roo.Template.json | 7 +++++++ docs/symbols/Roo.XTemplate.json | 7 +++++++ 6 files changed, 61 insertions(+) diff --git a/docs/json/roodata.json b/docs/json/roodata.json index f5120a97bb..b51fc0fbd8 100644 --- a/docs/json/roodata.json +++ b/docs/json/roodata.json @@ -4778,6 +4778,12 @@ "desc" : "The HTML fragment or an array of fragments to join(\"\") or multiple arguments to join(\"\")", "memberOf" : "Roo.Template" }, + { + "name" : "onLoad", + "type" : "Function", + "desc" : "Called after the template has been loaded and complied (usually from a remove source)", + "memberOf" : "Roo.Template" + }, { "name" : "url", "type" : "String", @@ -10585,6 +10591,12 @@ "desc" : "The HTML fragment or an array of fragments to join(\"\") or multiple arguments to join(\"\")", "memberOf" : "Roo.Template" }, + { + "name" : "onLoad", + "type" : "Function", + "desc" : "Called after the template has been loaded and complied (usually from a remove source)", + "memberOf" : "Roo.Template" + }, { "name" : "url", "type" : "String", @@ -13519,6 +13531,12 @@ "desc" : "The HTML fragment or an array of fragments to join(\"\") or multiple arguments to join(\"\")", "memberOf" : "" }, + { + "name" : "onLoad", + "type" : "Function", + "desc" : "Called after the template has been loaded and complied (usually from a remove source)", + "memberOf" : "" + }, { "name" : "url", "type" : "String", @@ -16029,6 +16047,12 @@ "desc" : "The HTML fragment or an array of fragments to join(\"\") or multiple arguments to join(\"\")", "memberOf" : "Roo.Template" }, + { + "name" : "onLoad", + "type" : "Function", + "desc" : "Called after the template has been loaded and complied (usually from a remove source)", + "memberOf" : "Roo.Template" + }, { "name" : "url", "type" : "String", diff --git a/docs/src/Roo_Template.js.html b/docs/src/Roo_Template.js.html index 916144f89f..899b4c022f 100644 --- a/docs/src/Roo_Template.js.html +++ b/docs/src/Roo_Template.js.html @@ -53,6 +53,12 @@ t.append('some-element', {id: 'myid', cls: 'myclass', name: 'foo', value: 'bar'} }; Roo.Template.prototype = { + /** + * @cfg {Function} onLoad Called after the template has been loaded and complied (usually from a remove source) + */ + onLoad : false, + + /** * @cfg {String} url The Url to load the template from. beware if you are loading from a url, the data may not be ready if you use it instantly.. * it should be fixed so that template is observable... @@ -130,6 +136,9 @@ t.append('some-element', {id: 'myid', cls: 'myclass', name: 'foo', value: 'bar'} _t.html = response.responseText; _t.url = false; _t.compile(); + if (_t.onLoad) { + _t.onload(); + } }, failure : function(response) { Roo.log("Template failed to load from " + _t.url); diff --git a/docs/symbols/Roo.DomTemplate.json b/docs/symbols/Roo.DomTemplate.json index 5bff0fa67f..bfd0e5d085 100644 --- a/docs/symbols/Roo.DomTemplate.json +++ b/docs/symbols/Roo.DomTemplate.json @@ -15,6 +15,13 @@ "params" : [], "returns" : [], "config" : [ + { + "name" : "onLoad", + "type" : "Function", + "desc" : "Called after the template has been loaded and complied (usually from a remove source)", + "memberOf" : "Roo.Template", + "optvals" : [] + }, { "name" : "html", "type" : "String", diff --git a/docs/symbols/Roo.MasterTemplate.json b/docs/symbols/Roo.MasterTemplate.json index a93ee10bda..9c86f916a0 100644 --- a/docs/symbols/Roo.MasterTemplate.json +++ b/docs/symbols/Roo.MasterTemplate.json @@ -15,6 +15,13 @@ "params" : [], "returns" : [], "config" : [ + { + "name" : "onLoad", + "type" : "Function", + "desc" : "Called after the template has been loaded and complied (usually from a remove source)", + "memberOf" : "Roo.Template", + "optvals" : [] + }, { "name" : "html", "type" : "String", diff --git a/docs/symbols/Roo.Template.json b/docs/symbols/Roo.Template.json index d1c4cce646..df4aa66409 100644 --- a/docs/symbols/Roo.Template.json +++ b/docs/symbols/Roo.Template.json @@ -20,6 +20,13 @@ ], "returns" : [], "config" : [ + { + "name" : "onLoad", + "type" : "Function", + "desc" : "Called after the template has been loaded and complied (usually from a remove source)", + "memberOf" : "Roo.Template", + "optvals" : [] + }, { "name" : "html", "type" : "String", diff --git a/docs/symbols/Roo.XTemplate.json b/docs/symbols/Roo.XTemplate.json index 51afaaf932..d7f671f79c 100644 --- a/docs/symbols/Roo.XTemplate.json +++ b/docs/symbols/Roo.XTemplate.json @@ -15,6 +15,13 @@ "params" : [], "returns" : [], "config" : [ + { + "name" : "onLoad", + "type" : "Function", + "desc" : "Called after the template has been loaded and complied (usually from a remove source)", + "memberOf" : "Roo.Template", + "optvals" : [] + }, { "name" : "html", "type" : "String", -- 2.39.2