Results 1 to 3 of 3

Thread: [4.2.0b] Returning false from TreePanel beforeitemexpand makes the node unexpandable

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User Daniil's Avatar
    Join Date
    Jun 2010
    Location
    Saint-Petersburg, Russia
    Posts
    1,018

    Default [4.2.0b] Returning false from TreePanel beforeitemexpand makes the node unexpandable

    REQUIRED INFORMATION

    Ext version tested:

    • Ext 4.2.0 beta

    Browser versions tested against:
    • Chrome
    • IE9

    DOCTYPE tested against:
    • <!DOCTYPE html>

    Description:
    • Returning false from a TreePanel's beforeitemexpand listener makes the node unexpandable and the beforeitemexpand event is not fired anymore.
    • The same behavior is with the TreeStore's beforeexpand and beforeload events.
    • This is related to this bug report.

    Steps to reproduce the problem:
    • Expand the Root
    • A JavaScript confirmation box appears
    • Click Cancel
    • Try to expand the Root again

    The result that was expected:
    • The node remains expandable

    The result that occurs instead:
    • The node becomes unexpandable and the beforeitemexpand event is not fired anymore.

    Test Case:
    Code:
    <!DOCTYPE html>
    <html>
    <head>
        <title>TreePanel/TreeStore BeforeLoad Bug</title>
    
        <link rel="stylesheet" href="../resources/css/ext-all.css" />
        
        <script src="../ext-all.js"></script>
    
        <script>
            Ext.onReady(function () {
                Ext.create("Ext.tree.Panel", {
                    renderTo: Ext.getBody(),
                    height: 300,
                    width: 300,
                    root: {
                        expanded: false,
                        text: "Root",
                        children: [{
                            text: "Node1"
                        }, {
                            text: "Node2"
                        }, {
                            text: "Node3"
                        }]
                    },
                    listeners: {
                        beforeitemexpand: {
                            fn: function () {
                                return confirm("Allow?");
                            }
                        }
                    }
                });
            });
        </script>
    </head>
    <body>
    
    </body>
    </html>
    Object.NET
    Frameworks and Tools for .NET Developers
    --------------------------------------------------
    Ext.NET - Ext JS for ASP.NET - Examples | Twitter
    Bridge.NET - Write C#. Run JavaScript! - Live | Twitter
    --------------------------------------------------

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha User Daniil's Avatar
    Join Date
    Jun 2010
    Location
    Saint-Petersburg, Russia
    Posts
    1,018

    Default

    The node's isExpandingOrCollapsing flag is not reset if return false.

    So, resetting it manually appears to be a solution for now.

    Example
    Code:
    var allow = confirm('Really?'); 
                        
    if (!allow) {
        node.isExpandingOrCollapsing = false;
        return false;
    }
    Object.NET
    Frameworks and Tools for .NET Developers
    --------------------------------------------------
    Ext.NET - Ext JS for ASP.NET - Examples | Twitter
    Bridge.NET - Write C#. Run JavaScript! - Live | Twitter
    --------------------------------------------------

Posting Permissions

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