Results 1 to 6 of 6

Thread: [FIXED] [3.0] unexpected amount of items in basicform

  1. #1

    Question [FIXED] [3.0] unexpected amount of items in basicform

    if a field is added to a formpanel, the field will also be added to the underlying basicform.
    if a field is added to a fieldset, that's part of a formpanel, the field is not added to the basicform.
    Is this expected behaviour?
    Just to make it clear in code :

    Code:
    //
    // adding field to formpanel person, initial amount of items is 2, 
    //  also adds field to underlying basicform
    person.add({xtype:'textfield',fieldLabel:'test',name:'test'});
    person.doLayout();
    var c1 = person.getForm().items.items.length; // returns 3
    //
    // adding field to fieldset fs does not add field to underlying basicform
    var fs = person.find('name','fs')[0];
    fs.add({xtype:'textfield',fieldLabel:'test2',name:'test2'});
    person.doLayout();	
    c1 = person.getForm().items.items.length; // is still 3 !???
    I have attached the code that could be used as a testcase to this post.
    Just drop it in your examples folder and it should run fine.
    Attached Files Attached Files

  2. #2
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664

    Default

    Looks like a bug. Do you want me to move this thread to Bugs?
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


  3. #3

    Default

    Thanks for the quick update.
    When this is a bug indeed please move it.

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    This has been a defect in Ext since the first Ext 2 release.

    To correctly fix this you probably need add and remove event bubbling.

  5. #5

    Default

    Thanks for the update. Posted a request for information on how to bubble events to implement this behaviour over here http://extjs.com/forum/showthread.php?t=63157

  6. #6
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243

    Default

    It turns out there was a bug with event bubbling. Basically it wasnt bubbling at all
    Since I fixed it, the problem you describe here is fixed in 3.0.

    I used the following testcase in FireBug after creating a formpanel with a fieldset in it, which containers 4 items before the following code is executed:

    Code:
    var formpanel = Ext.getCmp('test-formpanel');
    var fieldset = Ext.getCmp('test-fieldset');
    
    fieldset.on('add', function() { console.log('FieldSet add: ', arguments) });
    formpanel.on('add', function() { console.log('FormPanel add: ', arguments) });
    
    console.log('BasicForm length: ', formpanel.getForm().items.items.length);
    fieldset.add({xtype:'textfield',fieldLabel:'test',name:'test'});
    fieldset.doLayout();
    console.log('BasicForm length after add: ', formpanel.getForm().items.items.length);
    This now, in contrast to before, logs the following correct output:
    Code:
    BasicForm length:  4
    FieldSet add: [Object initialConfig=Object xtype=fieldset, Object initialConfig=Object xtype=textfield, 4]
    FormPanel add: [Object initialConfig=Object xtype=fieldset, Object initialConfig=Object xtype=textfield, 4]
    BasicForm length after add: 5

Posting Permissions

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