PDA

View Full Version : Render a new Textfield in a Panel



grubby69
12 Aug 2011, 2:17 AM
Hi,
I wish to render a new textfiled in a panel after an event on a button tbar.
The problem is that the textfiled appear,but not in the position I want!!!

This is the code:


MyViewport = Ext.extend(MyViewportUi, {
initComponent: function() {

MyViewport.superclass.initComponent.call(this);


//Dati del template
var data = {
data: '12/08/2011',
testo: "Questo e' il primo progetto",
user: 'Walter'
};



//Creo il Panello
var p = new Ext.Panel({

title: 'To Do List',
width: 700,
html: 'Iniziamo da <B>qui</B>.',
tbar: [{
text: 'Start',
handler: function(){

var tpl = new Ext.Template(
'Data: {data}<br>',
'Testo: {testo}<br>',
'User: {user}<br>'
);
tpl.overwrite(p.body, data);
p.body.highlight('#00ff00', {block:true});

//Aggiunge un campo testo
var tfield = new Ext.form.TextField({
id: 'idTField',
x: 50,
y: 80,
width: 270

});
p.add(tfield);
p.doLayout();

}
}],

renderTo: Ext.getBody()
});

}
});



I have try to set the panel with layout absolute ,but it doens't render any more the textfield!?!

Why?
How can I do?

thanks a lot...

:(

grubby69
12 Aug 2011, 4:23 AM
Resolved!
I have used the layout absolute but I have give a position and a dimension to the panel,so the texfield has a point to coordinate himself.

bye B)