PDA

View Full Version : Align items in a formPanel



sfssousa
27 May 2009, 3:18 PM
Hi
I want align all items in a formPanel to left.

for the buttons i use buttonAlign, but for the items?



Ext.onReady(function(){

//Ext.QuickTips.init();

var msg = function(title, msg){
Ext.Msg.show({
title: title,
msg: msg,
minWidth: 200,
modal: true,
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
};


var fp = new Ext.FormPanel({
renderTo: 'FrameForm',
fileUpload: true,
width: 500,
frame: true,
title: 'Upload de ficheiros',
autoHeight: true,
bodyStyle: 'padding: 10px 10px 0 10px;',
labelWidth: 50,
buttonAlign:'center',
defaults: {
allowBlank: false,
msgTarget: 'side'
},
items: [{
xtype: 'textfield',
fieldLabel: 'Name'
},{
xtype: 'combo',
fieldLabel:'Utilizador',
store : new Ext.data.JsonStore({
url: 'GetUserCombo.php',
baseParams: { method: 'get' },
root: 'rows',
fields:[
{name: 'id', type: 'int'},
{name: 'nome'}
]
}),
displayField:'nome',
valueField:'id',
triggerAction:'all',
editable:false,
setHorizontalAlign: 'LEFT'
},{
xtype: 'fileuploadfield',
id: 'form-file',
emptyText: 'Seleccione uma imagem',
fieldLabel: 'Imagem',
name: 'arquivo',
buttonCfg: {
text: '',
iconCls: 'upload-icon'
}
}],
buttons: [{
text: 'Save',
handler: function(){
if(fp.getForm().isValid()){
fp.getForm().submit({
url: 'IFicheirosTesteSet.php',
waitMsg: 'A enviar arquivo...',
success: function(fp, o){
msg('Sucesso', 'Arquivo "'+o.result.file+'" enviado.');
//fp.getForm().reset();
fp.reset();
},
failure: function (fp, o) { // when saving data failed
msg('Erro', 'Erro ao enviar o arquivo - '+o.result.file+' ');
}
});
}
}
},{
text: 'Reset',
handler: function(){
fp.getForm().reset();
}
}]
});

});

Animal
28 May 2009, 12:01 AM
But there are labels to the left of form items.

sfssousa
28 May 2009, 4:57 AM
Hi
the labels yes, but te textFields and the combo are centred to the center.
I need the align to the left

D'ont have the code here, but example:


Label1.......__________TextField__________
label2 ............_______Combo_______
Label3 .........._____UploadField_____

I Need:
Label1 ......._________TextField___________
label2 ........______Combo_______
Label3 .......________UploadField___

Animal
28 May 2009, 5:16 AM
You have some CSS interference.

sfssousa
28 May 2009, 6:49 AM
hi
in my html i have one center to center div in the page.

Is possible is this?



<body>
<table width="100%" height="100%" border="0">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="center"><div id="FrameForm"></div></td>
<td>&nbsp;</td>
</tr>
</table>
</body>

tryanDLS
28 May 2009, 7:29 AM
Yes, align=center will likely cause problems.

sfssousa
28 May 2009, 4:07 PM
thank you very much

is just that

I am still beginner, sorry :)