PDA

View Full Version : file upload filed



bozzoz
5 Oct 2010, 3:28 AM
How to implement the file upload field shown here (http://dev.sencha.com/deploy/dev/examples/form/file-upload.html) with the designer?

Thanks

jarrednicholls
5 Oct 2010, 4:06 AM
It should be fairly straightforward. If you follow the discussion here: http://www.sencha.com/forum/showthread.php?103560-How-to-replace-placeholder-components there is code that assists in replacing a placeholder component with the one you truly want, in this case, the FileUploadField ux.

Hope that helps!

bozzoz
5 Oct 2010, 5:42 AM
Ok, I have replaced a placeholder textField with fileUploadField but I have a problem with rendering.

this is the code of my form:


MyForm1Ui = Ext.extend(Ext.form.FormPanel, {
region: 'south',
height: 230,
frame: true,
itemId: 'formAssegnazione',
initComponent: function() {
this.initialConfig = Ext.apply({
fileUpload: true
}, this.initialConfig);
this.items = [
{
xtype: 'textfield',
fieldLabel: 'Id',
anchor: '100%',
name: 'id_all',
itemId: 'id_all',
readOnly: true,
ref: 'id_all'
},
{
xtype: 'textfield',
fieldLabel: 'Id pratica',
anchor: '100%',
name: 'id_pratica',
itemId: 'id_pratica',
readOnly: true,
ref: 'id_pratica'
},
{
xtype: 'textfield',
fieldLabel: 'Nome',
anchor: '100%',
readOnly: true,
itemId: 'nome',
name: 'nome',
ref: 'nome'
},
{
xtype: 'textarea',
fieldLabel: 'Descrizione',
anchor: '100%',
name: 'descrizione',
itemId: 'descrizione',
ref: 'descrizione'
},
{
xtype: 'textfield',
fieldLabel: 'File',
anchor: '95%',
itemId: 'allegato',
name: 'allegato',
allowBlank: false,
ref: 'allegato'
}
];
this.fbar = {
xtype: 'toolbar',
items: [
{
xtype: 'button',
text: 'Salva',
itemId: 'salva',
ref: '../btSalva'
}
]
};
MyForm1Ui.superclass.initComponent.call(this);
}
});


and this is the code that replaces the component "allegato":



this.allegato.replaceWith({
xtype: 'fileuploadfield',
emptyText: 'Seleziona un documento',
buttonText: '',
buttonCfg: {
iconCls: 'upload-icon'
}
});


but when I open my window the fileUploadField show the vertical scroll bar.

22678

Any suggestion?

novoline
5 Oct 2010, 8:56 PM
That would help me. Thanks

jarrednicholls
6 Oct 2010, 5:18 AM
bozzoz,

Have you tried calling "doLayout()" on the form?

bozzoz
6 Oct 2010, 7:54 AM
Yes I have tried now, but the problems is the same. I'm calling this.formAssegnazione.doLayout() just after the code that replace the component.