Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-8386 in a recent build.
  1. #1
    Sencha User Daniil's Avatar
    Join Date
    Jun 2010
    Location
    Saint-Petersburg, Russia
    Posts
    974
    Vote Rating
    108
    Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all

      0  

    Default [4.2.0 beta 2] BasicForm doesn't get dynamically added items

    [4.2.0 beta 2] BasicForm doesn't get dynamically added items


    REQUIRED INFORMATION

    Ext version tested:
    • Ext 4.2.0 beta 2
    Browser versions tested against:
    • Chrome
    • IE9
    DOCTYPE tested against:
    • <!DOCTYPE html>
    Description:
    • A BasicForm doesn't get dynamically added items if they are not added directly to a FormPanel, but somewhere down in hierarchy. So, they are not submitted.
    • It works with ExtJS 4.1.1.
    • As a workaround we reset "_fields" after adding new items. It forces the fields query to be re-executed.
    Code:
    formPanel.getForm()._fields = null;


    Steps to reproduce the problem:
    • Click the "add" button
    • Click the "getFields" button
    The result that was expected:
    • "1" in the alert box, i.e. one field in the BasicForm
    The result that occurs instead:
    • "0" in the alert box
    Test Case:

    Code:
    <!DOCTYPE html>
    <html>
    <head>
        <title>BasicForm doesn't get dynamically added items</title>
    
        <link rel="stylesheet" href="../resources/css/ext-all.css" />
        
        <script src="../ext-all-debug.js"></script>
    
        <script>
            Ext.onReady(function () {
                Ext.create("Ext.button.Button", {
                    renderTo: Ext.getBody(),
                    text: "Add a field to the interim container",
                    handler: function () {
                        Ext.getCmp("SomeInterimContainer1").add({
                            xtype: "textfield",
                            value: "Hello"
                        });
                    }
                });
    
                Ext.create("Ext.button.Button", {
                    renderTo: Ext.getBody(),
                    text: ".getFields().getCount()",
                    handler: function () {
                        alert(Ext.getCmp("FormPanel1").getForm().getFields().getCount());
                    }
                });
    
                Ext.create("Ext.form.Panel", {
                    id: "FormPanel1",
                    renderTo: Ext.getBody(),
                    items: [{
                        id: "SomeInterimContainer1",
                        xtype: "container"
                    }]
                });
            });
        </script>
    </head>
    <body>
    
    </body>
    </html>
    Ext.NET - ASP.NET for Ext JS
    MVC and WebForms
    Examples | Twitter

  2. #2
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,294
    Vote Rating
    121
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    I've moved this to the 4.2.0 Beta forum - thanks for the report by the way!

    This area was impacted by performance work in the component life-cycle (add and remove events no longer bubble) and it was a bit tricky to achieve its goals without creating a performance drain on all components and containers. In case you were interested in all that

    We'll get this squared away.
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  3. #3
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,294
    Vote Rating
    121
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    I knew there was more than idle interest I had in mind in mentioning the above ... due to that change, the form / basicform no longer tracks references to all of its descendant fields - it gathers them when needed.

    This tends to be a bargain vs burdening the life-cycle of all components and containers to track this for use in an infrequently called method (typically called based on user interaction).
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  4. #4
    Sencha User Daniil's Avatar
    Join Date
    Jun 2010
    Location
    Saint-Petersburg, Russia
    Posts
    974
    Vote Rating
    108
    Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all

      0  

    Default


    Thank you for the answer, Don.

    Quote Originally Posted by dongryphon View Post
    I've moved this to the 4.2.0 Beta forum - thanks for the report by the way!
    Should I post all beta release issues in this forum? Just I already posted many ones in the Bugs forum and this is the first time when the thread was moved to the Beta forum.

    Thank you for the explanation of the root of the issue. I guessed it.

    So, the fields should be re-requested each getFields call? (It is about how you are going to fix it. Just curios.)
    Ext.NET - ASP.NET for Ext JS
    MVC and WebForms
    Examples | Twitter

  5. #5
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,294
    Vote Rating
    121
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    Quote Originally Posted by Daniil View Post
    Should I post all beta release issues in this forum? Just I already posted many ones in the Bugs forum and this is the first time when the thread was moved to the Beta forum.
    It is not necessary, but helps somewhat get the right people to see the report. During beta, the dev team is more actively looking at beta issues and they focus in the beta forum. The bugs forum is more focused on support of current released versions.

    All that is just internal -and we don't always move them around since once they are processed internally it does not matter too much where they live on the forum.

    Quote Originally Posted by Daniil View Post
    Thank you for the explanation of the root of the issue. I guessed it.

    So, the fields should be re-requested each getFields call? (It is about how you are going to fix it. Just curios.)
    Yes, each call to getFields will have to acquire the current set (deeply). Internally, to determine valid / dirty state, we will probably use ComponentQuery and the "down" method to see if there are any invalid or dirty fields. Still a bit TBD, but I would avoid calling getFields in a loop or anything
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  6. #6
    Sencha User Daniil's Avatar
    Join Date
    Jun 2010
    Location
    Saint-Petersburg, Russia
    Posts
    974
    Vote Rating
    108
    Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all

      0  

    Default


    Ok, clear, thank you for the explanation!
    Ext.NET - ASP.NET for Ext JS
    MVC and WebForms
    Examples | Twitter

  7. #7
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    14
    Vote Rating
    1
    masood is on a distinguished road

      0  

    Default Which version?

    Which version?


    I seem to have this bug in ext-4.2.0.489. Is there a newer download available? or a path to beta source code?
    (Sorry still a bit new to forums and where things are at).
    Cheers

  8. #8
    Sencha User Daniil's Avatar
    Join Date
    Jun 2010
    Location
    Saint-Petersburg, Russia
    Posts
    974
    Vote Rating
    108
    Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all

      0  

    Default


    The last public download is 4.2 RC. I think it is Sprint 3.

    This bug is marked fixed in Sprint 4. So, it will be available with the next public download.

    So, currently, it should be available in SVN only. So, I don't know the location.
    Ext.NET - ASP.NET for Ext JS
    MVC and WebForms
    Examples | Twitter

  9. #9
    Sencha User Sharkanana's Avatar
    Join Date
    Nov 2011
    Location
    Charlotte, NC
    Posts
    39
    Vote Rating
    0
    Sharkanana is on a distinguished road

      0  

    Default


    Code:
    formPanel.getForm()._fields = null;
    Did not work form me(accidental pun). After dynamically changing my form, I had to use:

    Code:
    form.getForm().monitor.invalidateItems();
    This affected my form when using getFields, and submit.