<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
</head>
<body onload="prettyPrint();">
<pre class="prettyprint lang-js">/*!
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
</head>
<body onload="prettyPrint();">
<pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
+ * Ext JS Library 3.3.1
+ * Copyright(c) 2006-2010 Sencha Inc.
+ * licensing@sencha.com
+ * http://www.sencha.com/license
* @constructor
* The {@link Ext.Template#Template Ext.Template constructor} describes
* the acceptable parameters to pass to the constructor. The following
* examples demonstrate all of the supported features.</p>
* @constructor
* The {@link Ext.Template#Template Ext.Template constructor} describes
* the acceptable parameters to pass to the constructor. The following
* examples demonstrate all of the supported features.</p>
* <div class="sub-desc">
* <p>The <b><tt>tpl</tt></b> tag and the <b><tt>for</tt></b> operator are used
* to process the provided data object:
* <div class="sub-desc">
* <p>The <b><tt>tpl</tt></b> tag and the <b><tt>for</tt></b> operator are used
* to process the provided data object:
* <div class="sub-desc">
* <p>The <b><tt>tpl</tt></b> tag and the <b><tt>if</tt></b> operator are used
* to provide conditional checks for deciding whether or not to render specific
* <div class="sub-desc">
* <p>The <b><tt>tpl</tt></b> tag and the <b><tt>if</tt></b> operator are used
* to provide conditional checks for deciding whether or not to render specific
* <div class="sub-desc">
* <p>Anything between <code>{[ ... ]}</code> is considered code to be executed
* in the scope of the template. There are some special variables available in that code:
* <div class="sub-desc">
* <p>Anything between <code>{[ ... ]}</code> is considered code to be executed
* in the scope of the template. There are some special variables available in that code:
* <div class="sub-desc">
* <p>One or more member functions can be specified in a configuration
* object passed into the XTemplate constructor for more complex processing:</p>
* <div class="sub-desc">
* <p>One or more member functions can be specified in a configuration
* object passed into the XTemplate constructor for more complex processing:</p>
* @param {Mixed} config
*/
Ext.XTemplate = function(){
Ext.XTemplate.superclass.constructor.apply(this, arguments);
var me = this,
* @param {Mixed} config
*/
Ext.XTemplate = function(){
Ext.XTemplate.superclass.constructor.apply(this, arguments);
var me = this,
- s = me.html,
- re = /<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/,
- nameRe = /^<tpl\b[^>]*?for="(.*?)"/,
- ifRe = /^<tpl\b[^>]*?if="(.*?)"/,
- execRe = /^<tpl\b[^>]*?exec="(.*?)"/,
- m,
- id = 0,
- tpls = [],
- VALUES = 'values',
- PARENT = 'parent',
- XINDEX = 'xindex',
- XCOUNT = 'xcount',
- RETURN = 'return ',
- WITHVALUES = 'with(values){ ';
+ s = me.html,
+ re = /<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/,
+ nameRe = /^<tpl\b[^>]*?for="(.*?)"/,
+ ifRe = /^<tpl\b[^>]*?if="(.*?)"/,
+ execRe = /^<tpl\b[^>]*?exec="(.*?)"/,
+ m,
+ id = 0,
+ tpls = [],
+ VALUES = 'values',
+ PARENT = 'parent',
+ XINDEX = 'xindex',
+ XCOUNT = 'xcount',
+ RETURN = 'return ',
+ WITHVALUES = 'with(values){ ';
s = ['<tpl>', s, '</tpl>'].join('');
while((m = s.match(re))){
s = ['<tpl>', s, '</tpl>'].join('');
while((m = s.match(re))){
- var m2 = m[0].match(nameRe),
- m3 = m[0].match(ifRe),
- m4 = m[0].match(execRe),
- exp = null,
- fn = null,
- exec = null,
- name = m2 && m2[1] ? m2[1] : '';
+ var m2 = m[0].match(nameRe),
+ m3 = m[0].match(ifRe),
+ m4 = m[0].match(execRe),
+ exp = null,
+ fn = null,
+ exec = null,
+ name = m2 && m2[1] ? m2[1] : '';
// private
applySubTemplate : function(id, values, parent, xindex, xcount){
var me = this,
// private
applySubTemplate : function(id, values, parent, xindex, xcount){
var me = this,
if ((t.test && !t.test.call(me, values, parent, xindex, xcount)) ||
(t.exec && t.exec.call(me, values, parent, xindex, xcount))) {
return '';
if ((t.test && !t.test.call(me, values, parent, xindex, xcount)) ||
(t.exec && t.exec.call(me, values, parent, xindex, xcount))) {
return '';
- Ext.each(vs, function(v, i) {
- buf[buf.length] = t.compiled.call(me, v, parent, i+1, len);
- });
+ for(var i = 0, len = vs.length; i < len; i++){
+ buf[buf.length] = t.compiled.call(me, vs[i], parent, i+1, len);
+ }
return buf.join('');
}
return t.compiled.call(me, vs, parent, xindex, xcount);
return buf.join('');
}
return t.compiled.call(me, vs, parent, xindex, xcount);
// private
compileTpl : function(tpl){
var fm = Ext.util.Format,
// private
compileTpl : function(tpl){
var fm = Ext.util.Format,