Define template data in an array
<!--
/*!
* Ext JS Library 3.0.0
* Copyright(c) 2006-2009 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
*/
-->
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<body>
<!-- Revised from demo code from ext3.0.0 -->
<script type="text/javascript">
Ext.onReady(function() {
var data = {
name: 'A',
company: 'B',
city: 'D',
state: 'E'
};
var p = new Ext.Panel({
title: 'Title',
width: 300,
html: 'html code <B>here</B>',
tbar: [{
text: 'Template',
handler: function(){
var tpl = new Ext.Template(
'Name: {name}',
'Company: {company}',
'Location: {city}, {state}'
);
tpl.overwrite(p.body, data);
p.body.highlight('#00ff00', {block:true});
}
}],
renderTo: Ext.getBody()
});
});
</script>
</body>
</html>
Related examples in the same category