1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    41
    Vote Rating
    1
    rakagod is on a distinguished road

      0  

    Default setActiveItem(0) does not work

    setActiveItem(0) does not work


    In version 4.0.7, the following code worked
    Code:
    this.getDispatchCards().getLayout().setActiveItem(0);
    but in version 4.1 that line no longer works.
    The other 2 lines that reference "setActiveItem(1) and setActiveItem(2) still work.
    Also the default that set "activeItem: 0", no longer works.
    Code:
         },
            btnRequestPressed: function() {
                //alert('You clicked the ReceiveCall button!');
                this.getDispatchCards().getLayout().setActiveItem(0);
                this.getBtnRequest().disabled = true;
                this.getBtnDispatch().disabled = false;
                this.getBtnAdministration().disabled = false;
        },
            btnDispatchPressed: function() {
                //alert('You clicked the Dispatch button!');
                this.getDispatchCards().getLayout().setActiveItem(1);            
                this.getBtnRequest().disabled = false;
                this.getBtnDispatch().disabled = true;
                this.getBtnAdministration().disabled = false;            
        },
            btnAdministrationPressed: function() {
                //alert('You clicked the Administration button!');
                this.getDispatchCards().getLayout().setActiveItem(2);    
                this.getBtnRequest().disabled = false;
                this.getBtnDispatch().disabled = false;
                this.getBtnAdministration().disabled = true;            
        }
    The layout is as follows:
    Code:
    Ext.define('Calls.view.ui.MViewport', {
        extend: 'Ext.container.Viewport',
        requires: [
            'Calls.view.MainToolbar',
            'Calls.view.RequestForm',
            'Calls.view.DispatchForm'
        ],
    
    
        activeItem: 0,
    
    
        initComponent: function() {
            var me = this;
    
    
            Ext.applyIf(me, {
                items: [
                    {
                        xtype: 'panel',
                        itemId: 'dispatchPanels',
                        layout: {
                            type: 'fit'
                        }
                    },
                    {
                        xtype: 'mainToolbar'
                    },
                    {
                        xtype: 'panel',
                        itemId: 'dispatchCards',
                        activeItem: 0,
                        layout: {
                            type: 'card'
                        },
                        title: '',
                        items: [
                            {
                                xtype: 'panel',
                                itemId: 'requestFormSplit',
                                layout: {
                                    align: 'stretchmax',
                                    type: 'hbox'
                                },
                                items: [
                                    {
                                        xtype: 'requestForm',
                                        flex: 1
                                    },
                                    {
                                        xtype: 'panel',
                                        itemId: 'requestFormSpacePanel',
                                        flex: 1
                                    }
                                ]
                            },
                            {
                                xtype: 'dispatchForm'
                            },
                            {
                                xtype: 'panel',
                                itemId: 'administrationForm',
                                title: 'Administration',
                                items: [
                                    {
                                        xtype: 'label',
                                        text: 'Administration form'
                                    }
                                ]
                            }
                        ]
                    }
                ]
            });
    
    
            me.callParent(arguments);
        }
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,124
    Vote Rating
    855
    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


    This is working for me in 4.1 PR1:

    Code:
        Ext.create('Ext.container.Viewport', {
            layout : 'fit',
    
            items  : [
                {
                    xtype  : 'panel',
                    layout : 'card',
                    items  : [
                        {
                            title : 'One',
                            html  : 'One'
                        },
                        {
                            title : 'Two',
                            html  : 'Two'
                        }
                    ],
                    dockedItems : [
                        {
                            xtype : 'toolbar',
                            dock  : 'top',
                            items : [
                                {
                                    text     : 'Back',
                                    disabled : true,
                                    action   : 'back',
                                    handler  : function(btn) {
                                        var panel   = btn.up('panel'),
                                            toolbar = btn.up('toolbar'),
                                            forward = toolbar.down('button[action=forward]');
    
                                        panel.getLayout().setActiveItem(0);
    
                                        forward.enable();
                                        btn.disable();
                                    }
                                },
                                '->',
                                {
                                    text    : 'Forward',
                                    action  : 'forward',
                                    handler : function(btn) {
                                        var panel   = btn.up('panel'),
                                            toolbar = btn.up('toolbar'),
                                            back    = toolbar.down('button[action=back]');
    
                                        panel.getLayout().setActiveItem(1);
    
                                        back.enable();
                                        btn.disable();
                                    }
                                }
                            ]
                        }
                    ]
                }
            ]
        });
    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
    Sencha User
    Join Date
    Aug 2011
    Posts
    41
    Vote Rating
    1
    rakagod is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    This is working for me in 4.1 PR1:
    I designed the layout with Ext.Designer 1.2.2.
    It works under 4.0.7 but not under 4.1 PR1 (without changes).
    I am reporting a bug with my code and your response is to tell me that your code works.

    Congratulations, your code works. Unfortunately mine does not.
    Again, it works under 4.0.7 but not under 4.1 PR1.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,124
    Vote Rating
    855
    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


    Quote Originally Posted by rakagod View Post
    I designed the layout with Ext.Designer 1.2.2.
    It works under 4.0.7 but not under 4.1 PR1 (without changes).
    I am reporting a bug with my code and your response is to tell me that your code works.

    Congratulations, your code works. Unfortunately mine does not.
    Again, it works under 4.0.7 but not under 4.1 PR1.
    Really? Ok... Sorry your code isn't working, provided above is working for me so break your code down to figure out what is causing it to not work.

    You said "but in version 4.1 that line no longer works."... kind of hard to know why it doesn't work by that statement.

    Mainly... what component does getDispatchCards() get you because in my code I provided the rest is the same.

    Enjoy
    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.

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Posts
    41
    Vote Rating
    1
    rakagod is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Really? .. so break your code down to figure out what is causing it to not work.

    You said "but in version 4.1 that line no longer works."... kind of hard to know why it doesn't work by that statement.

    Mainly... what component does getDispatchCards() get you because in my code I provided the rest is the same.

    Enjoy
    I did break down the code, that line is where it stops working.
    I am including the full app which is tiny because I was just starting it.
    It is in a version 4 MVC architecture which so far, with other test apps, has proven to be a major pain.
    There is no data and no store, just code.
    Run it with 4.0.7 and see the 3 buttons work and display panels.
    Run it with 4.1 and see the first button not work and a different display with button 2.
    I created the layouts with the trial version of Ext.Designer 1.2.2.

    Now you have everything I have.
    Enjoy
    Attached Files

Thread Participants: 1