Why would this example fail when the XTemplate is built using string in double quotes, the same example works when string are defined whithin single quotes. The code just dies silently
var tplData = [{ // 1
color : "#FFE9E9",
name : 'Naomi White',
age : 25,
dob : '03/17/84',
cars : ['Jetta', 'Camry', 'S2000']
},{
color : "#E9E9FF",
name : 'John Smith',
age : 20,
dob : '10/20/89',
cars : ['Civic', 'Accord', 'Camry']
}];
var myTpl = new Ext.XTemplate( // 2
"<tpl for='.'>", // 3
"<div style='background-color: {color}; margin: 10px;'>",
"<b> Name :</b> {name}<br />",
"<b> Age :</b> {age}<br />",
"<b> DOB :</b> {dob}<br />",
"</div>",
"</tpl>"
);
myTpl.compile();
myTpl.append(document.body, tplData);
The same example with single quotes strings.
var tplData = [{ // 1
color : "#FFE9E9",
name : 'Naomi White',
age : 25,
dob : '03/17/84',
cars : ['Jetta', 'Camry', 'S2000']
},{
color : "#E9E9FF",
name : 'John Smith',
age : 20,
dob : '10/20/89',
cars : ['Civic', 'Accord', 'Camry']
}];
var myTpl = new Ext.XTemplate( // 2
'<tpl for=".">', // 3
'<div style="background-color: {color}; margin: 10px;">',
'<b> Name :</b> {name}<br />',
'<b> Age :</b> {age}<br />',
'<b> DOB :</b> {dob}<br />',
'</div>',
'</tpl>'
);
myTpl.compile();
myTpl.append(document.body, tplData);