PDA

View Full Version : Clear tpl?



trisport88
5 Oct 2012, 5:38 AM
Hi all,

I have implemented an application with some functionality very similar too this example:

http://dev.sencha.com/deploy/ext-4.0.0/examples/direct/direct.html

Basically I copied it and modified for my purposes. I need to add in the ability to 'clear' the output. Is this possible? The output panel is an item on another panel and is defined as follows:

{
x:5,
y: 155,
id: 'output',
xtype: 'panel',
tpl: '<p>{data}</p>',
tplWriteMode: 'append',
margin: 0,
hideLabel: true,
readOnly: true,
autoScroll: true,
anchor: '-5 -5' // anchor width and height
}

Thanks in advance.

Tim Toady
5 Oct 2012, 6:10 AM
So you need to overwrite the tpl instead of append to it. Something like this



yourPanel.tpl.overwrite( yourPanel.getTargetEl() );


Or if you don't want to use private methods/properties you could set the tplWriteMode to 'overwrite' and call update, but then you would need to set it back to append.

trisport88
5 Oct 2012, 6:25 AM
Thanks :)