Results 1 to 5 of 5

Thread: help component extension

  1. #1

    Default help component extension

    Hi,

    I am new to ExtJs, I am learning it since a few weeks.
    Now I would like to expand my knowledge and I am trying to write a little extension.

    My goal is to have a very simple "multiupload field" which allow me to upload more than one file.
    In this moment I'm using the Ext.form.FileUploadField control, which I've found in the examples page, but it allows to upload just one file.

    I wrote this initially test code. I don't receive any error, but it is not the result I expected.

    Code:
    Ext.form.MultiFileUpload = Ext.extend(Ext.Panel,  {
    
        initComponent: function(){
            Ext.form.MultiFileUpload.superclass.initComponent.call(this);
        },
    
        onRender : function(ct, position){
    
            Ext.form.MultiFileUpload.superclass.onRender.call(this, ct, position);
    // first upload field
            this.multiselector = new Ext.form.FileUploadField({
                emptyText: 'Seleziona un\'immagine',
                name: 'pictures_1',
                width:250
            });
            
            this.multiselector.on('fileselected', function(){
    // second upload field
                new_multiselector = new Ext.form.FileUploadField({
                    id:'primo',
                    emptyText: 'Seleziona un\'immagine',
                    name: 'pictures',
                    width:250
                });
    // insert the second before the first ??
                this.insert(1,new_multiselector);
                this.doLayout;
                
            }, this);
            
            this.add(this.multiselector);
    
        }
        
    });
    Ext.reg('multifileupload', Ext.form.MultiFileUpload);
    The first upload field appear, but when I select a file to upload, it doesn't create the second upload field ("fileselected" event). I think I'm making some mistake rendering the second component.

    Someone could help me?
    Thanks in advance.

    Andrea

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    So have you set a breakpoint in the "fileselected" handler function to check whether it is being fired, and if so, what happens?

  3. #3

    Default

    Yes I have set the breakpoint in "fileselected" handler and it is fired.
    The following code is executed.

    Code:
    this.insert(1,new_multiselector);
    But I have no the second upload field on the page.

  4. #4
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    this.doLayout;
    should be :
    this.doLayout()

  5. #5

    Default

    Great!
    this.doLayout;
    should be :
    this.doLayout()
    This was my mistake!
    Really many thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •