PDA

View Full Version : Template does not handle table layout



reynardmh
9 Dec 2011, 4:16 PM
Try running this code, it does not show anything.


<div id="tpl" style="display:none">
<table>
<tpl for=".">
<tr><td>{name}</td></tr>
</tpl>
</table>
</div>
<script type="text/javascript">


Ext.regModel('SuperModel', {
fields: ['name']
});
Ext.setup({
onReady: function() {
var v = new Ext.DataView({
tpl: Ext.XTemplate.from(Ext.get('tpl')),
store: new Ext.data.Store({
model:'SuperModel',
data: [
{name:'Ann'},
{name:'Bella'},
]
}),
itemSelector:'tr.astu',
});
new Ext.Panel({
fullscreen:true,
items: [v],
});
}
});


</script>




It works if you update the template like this, or if you just not use table at all.


<tpl for=".">
<table>
<tr><td>{name}</td></tr>
</table>
</tpl>

mitchellsimoens
10 Dec 2011, 7:07 AM
What happens if you don't use Ext.XTemplate.from and just create a new template with new Ext.XTemplate(//template here) ?

reynardmh
13 Dec 2011, 11:38 AM
yeah that seems to work. so I guess Ext.get('tpl') is trying to reformat it?