Results 1 to 5 of 5

Thread: setActiveItem(0) does not work

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    41
    Vote Rating
    1
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Posts
    41
    Vote Rating
    1
      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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Posts
    41
    Vote Rating
    1
      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 Attached Files

Posting Permissions

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