Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Ext JS Premium Member
    Join Date
    Mar 2008
    Location
    Phoenix, AZ
    Posts
    627
    Vote Rating
    10
    zombeerose will become famous soon enough zombeerose will become famous soon enough

      0  

    Default [4.1B3] Card layout does not activate item when removed

    [4.1B3] Card layout does not activate item when removed


    REQUIRED INFORMATION

    Ext version tested:
    • Ext 4.1 beta 3
    Browser versions tested against:
    • Chrome 17
    DOCTYPE tested against:
    • Strict
    Description:
    • Setting the active item of a card panel when a child component is removed does not work as expected.
    • Note: the 'remove' event is buffered intentionally. In real use, the container panel has multiple children that are destroyed at once when a user's authentication changes. The 'remove' handler would assign the last child item as the activeItem if available. However, this ultimately causes a conflict between the components being destroy vs displayed.
    Steps to reproduce the problem:
    • Run the code.
    • Click the "Close" button.
    The result that was expected:
    • When the Close button is clicked, the "default panel" should be set as the active item and now visible.
    The result that occurs instead:
    • The "default panel" is not displayed.
    Test Case:
    Code:
    Ext.create('Ext.panel.Panel',{
        activeItem: 0, //change to null to fix
        layout: {
            type: 'card'
        },
        items: [{
            html: 'Default Panel'
        },{
            html: 'Child 2',
            buttons: [{
                action: 'close',
                text: 'Close',
                handler: function(btn){
                    var panel = btn.up('panel');
                    panel.ownerCt.remove(panel);
                }
            }]
        }],
        listeners: {
            'afterrender': function(panel){
                panel.layout.setActiveItem(1);
            },
            'remove': {fn:function(panel,item){
                panel.layout.setActiveItem(0);
            },buffer:100}
        },
        title: 'Card Layout',
        frame: true,
        width: 100,
        height: 100,
        renderTo: Ext.getBody()
    });

    HELPFUL INFORMATION

    Additional CSS used:
    • only default ext-all.css
    Operating System:
    • WinXP Pro

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,207
    Vote Rating
    856
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thanks for the report.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Ext JS Premium Member
    Join Date
    Oct 2009
    Location
    Melrose, MA
    Posts
    48
    Vote Rating
    3
    hjones is on a distinguished road

      0  

    Default


    I seem to have stumbled on this...container with card layout.Two panels added to the container.Removing one of the panel's I then do a container.getLayout().setActiveItem(..) on the remaining child panel.But it does not show...debugging setActiveItem the layout already thinks the first panel is the activeItem.Removing the second panel forces the layout to pick a different (previous?) item...in this case the zero-indexed item.I seem to have a work around by adding a dummy container in as the first item to the container.

Thread Participants: 2