PDA

View Full Version : File Uploader field disapear after second time being rendered



ipreti
23 Sep 2009, 3:13 PM
Hi guys.
Im facing a weird problem while trying to build a form with FileUploader plugin.
Every time i get the form with this field opened it simply disapear.
The code is :




var fileupload = new Ext.ux.form.FileUploadField({
id: 'form-file',
width: 400,
emptyText: 'Select a file',
fieldLabel: 'File',
name: 'file',
buttonText: '',
buttonCfg: {
iconCls: 'upload-icon'
}

});

form.add(fileupload);


where form is my form.
I dont perform any logic to enable or disable this field. It just disapear by itself at the second time i get the form opened.
Anyone knows what could be happening?
Thanks in advance.

27 Sep 2009, 6:21 PM
try adding: form.doLayout(); after form.add(fileupload);

You need to call doLayout to actually perform the DOM manipulation necessary.

I cover this stuff in the early chapters of Ext JS in Action: http://manning.com/garcia

ipreti
28 Sep 2009, 4:21 AM
Thanks jgarcia for the reply.
I've actually found the reason for this weird behavior.
When using fileuploader plugin it is necessary to give diferent ids to each instance that you put in your form (or diferent forms).
So.. i settled a static constant inside my class that get incremented and concatenated in the id value.
This action sort out my problem.
Ivan.