Clear Up
SharpKit Reference

Template Class

Namespace: Ext

Base Types

System.Object

Constructors

Name Description
Template()
Template(TemplateConfig)
Template(object) Creates new template. @param {String...} html List of strings to be concatenated into template. Alternatively an array of strings can be given, but then no config object may be passed. @param {Object} config (optional) Config object

Methods

Name Description
append(object, object, bool) Applies the supplied `values` to the template and appends the new node(s) to the specified `el`. * For example usage see {@link Ext.Template Ext.Template class docs}. * @param {String/HTMLElement/Ext.Element} el The context element @param {Object/Array} values The template values. See {@link #applyTemplate} for details. @param {Boolean} returnElement (optional) true to return an Ext.Element. @return {HTMLElement/Ext.Element} The new node or Element
apply(object) Returns an HTML fragment of this template with the specified values applied. * @param {Object/Array} values The template values. Can be an array if your params are numeric: * var tpl = new Ext.Template('Name: {0}, Age: {1}'); tpl.apply(['John', 25]); * or an object: * var tpl = new Ext.Template('Name: {name}, Age: {age}'); tpl.apply({name: 'John', age: 25}); * @return {String} The HTML fragment
applyOut(object, JsArray) Appends the result of this template to the provided output array. @param {Object/Array} values The template values. See {@link #apply}. @param {Array} out The array to which output is pushed. @return {Array} The given out array.
applyTemplate() @method applyTemplate @member Ext.Template Alias for {@link #apply}. @alias Ext.Template#apply
compile() Compiles the template into an internal function, eliminating the RegEx overhead. @return {Ext.Template} this
doInsert(object, object, object, object)
insertAfter(object, object, bool) Applies the supplied values to the template and inserts the new node(s) after el. * @param {String/HTMLElement/Ext.Element} el The context element @param {Object/Array} values The template values. See {@link #applyTemplate} for details. @param {Boolean} returnElement (optional) true to return a Ext.Element. @return {HTMLElement/Ext.Element} The new node or Element
insertBefore(object, object, bool) Applies the supplied values to the template and inserts the new node(s) before el. * @param {String/HTMLElement/Ext.Element} el The context element @param {Object/Array} values The template values. See {@link #applyTemplate} for details. @param {Boolean} returnElement (optional) true to return a Ext.Element. @return {HTMLElement/Ext.Element} The new node or Element
insertFirst(object, object, bool) Applies the supplied values to the template and inserts the new node(s) as the first child of el. * @param {String/HTMLElement/Ext.Element} el The context element @param {Object/Array} values The template values. See {@link #applyTemplate} for details. @param {Boolean} returnElement (optional) true to return a Ext.Element. @return {HTMLElement/Ext.Element} The new node or Element
overwrite(object, object, bool) Applies the supplied values to the template and overwrites the content of el with the new node(s). * @param {String/HTMLElement/Ext.Element} el The context element @param {Object/Array} values The template values. See {@link #applyTemplate} for details. @param {Boolean} returnElement (optional) true to return a Ext.Element. @return {HTMLElement/Ext.Element} The new node or Element
set(JsString, bool) Sets the HTML used as the template and optionally compiles it. @param {String} html @param {Boolean} compile (optional) True to compile the template. @return {Ext.Template} this

Properties

Name Description
compileARe
compileBRe
compileCRe
disableFormats @cfg {Boolean} disableFormats True to disable format functions in the template. If the template doesn't contain format functions, setting disableFormats to true will reduce apply time. Defaults to false.
isTemplate
re @cfg {Boolean} disableFormats True to disable format functions in the template. If the template doesn't contain format functions, setting disableFormats to true will reduce apply time. Defaults to false.
© Copyright 2005-2011 SharpKit. All rights reserved.