Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Template Manager's createTemplate method (API) enables you to render any template on to an object. TheĀ createTemplate API takes the following parameters:

ParameterData TypeMandatory or OptionalDescription
TemplateUrlsStringMandatoryThis parameter denotes the template URLs or the file names, which can be a string or an array of URLs.
tmplParamsStringOptionalThis optional parameter denotes the template parameters or input object, which can be an array of values to be passed to the place holders of the templates. An empty object can also be passed as the parameter.
basePathStringOptionalThis optional parameter denotes the template URLs or the template path. An empty object can be passed as the parameter.

The createTemplate API returns the new instance of the Template Manager class.

...

Code Block
languagejs
var tmpLayer = canvas.templateManager.createTemplate('al-app-footer.cttpl',AppFooter,canvas.util.getFWTemplatePath());
tmpLayer.getTemplate(this.applyTemplate, this);

/* Here,

*  'al-app-footer.cttpl' is the template file.
*  'AppFooter' is the template parameter. 
*  'canvas.util.getFWTemplatePath' is the function that fetches the template path.
*  'getTemplate' method is intended to execute the callback function with the compiled 
*  template in the scope passed as input.
*/