PDA

View Full Version : XTemplate not rendering more than once - ExtJS



abram.darnutzer
27 Jun 2013, 9:25 AM
I have a View that is using XTemplate.

extend: 'Ext.view.View', xtype: 'idView', width: 300, itemSelector: 'aside.x-item', loadMask: false, overflowY: 'auto', itemTpl: new Ext.XTemplate( '<tpl for=".">', '<p>{id}</p>', '</tpl>', ),I'm referencing the object in 2 panels. This panel is shown first and it displays the Xtemplate just fine.

{ xtype: 'idView', itemId: 'first-idview', store: 'IDStore', }But on the second panel that I try to use it, nothing shows up. The ExtJS code for it is exactly the same as above. Is there something that I'm missing here?

slemmon
1 Jul 2013, 12:36 PM
The following seems to work ok for me. Am I missing something in the test case?
*Don't forget to wrap your code in code blocks for readability



Ext.define('MyView', {
extend: 'Ext.view.View',
xtype: 'idView',
width: 300,
itemSelector: 'aside.x-item',
loadMask: false,
overflowY: 'auto',
itemTpl: new Ext.XTemplate('<tpl for=".">', '<p>{id}</p>', '</tpl>')
});


Ext.create('MyView', {
renderTo: document.body,
height: 100, width: 100,
store: {
fields: ['id'],
data: [{
id: 1
}, {
id: 2
}]
}
});


Ext.create('MyView', {
renderTo: document.body,
height: 100, width: 100,
store: {
fields: ['id'],
data: [{
id: 1
}, {
id: 2
}]
}
});