---
title: "extjs中XTemplate表达式的用法"
author: "fourfire"
date: "2009-07-18T12:25:46Z"
tags: []
slug: "extjs-xtemplate"
draft: false
lastmod: "2009-07-18T12:25:46Z"
id: 428445
url: "https://fourfire.iteye.com/blog/428445"
---

1 嵌入函数


```js

new Ext.XTemplate('<tpl if="isSameUnit(a,b,c)==true">'.</tpl>..,{
				isSameUnit : function(unit1, unit2, unit3) {
					return ((unit1 == unit2) && (unit1 == unit3));
				}
			}
)

```

2
'<tpl if="xindex==1 && imagePath!=null">' +
			'<img   width="100" height="80" src="viewPhoto.do?path={imagePath}"/>' +
			'</tpl>'+