Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    6
    Vote Rating
    0
    A.Wagner is on a distinguished road

      0  

    Default EXT JS 4.1.1 Ext.State.Manager not working anymore

    EXT JS 4.1.1 Ext.State.Manager not working anymore


    REQUIRED INFORMATION




    Ext version tested:
    • Ext 4.1.1

    Browser versions tested against:
    • Chrome 20

    Description:
    • Ext.state.Manager don't work at all

    Steps to reproduce the problem:
    • Setiing Ext.state.Manager with a CookieProvider and set up a panel with stateful:true and a stateId
    • Set up a BeforeStateSave event to test if something happens
    • Collapse panel and reload
    • Panel is not collapsed

    The result that was expected:
    • After collapse the panel and reload the panel should be collapsed

    The result that occurs instead:
    • Nothing happens. After reload the panel is not collapsed

    Test Case:


    Code:
        Ext.define('MyApp.view.MyViewport', {
        extend: 'Ext.container.Viewport',
    
    
        layout: {
            type: 'fit'
        },
    
    
        initComponent: function() {
            var me = this;
    
    
            Ext.applyIf(me, {
                items: [
                    {
                        xtype: 'panel',
                        stateId: 'myPan',
                        collapsible: true,
                        title: 'My Panel',
                        listeners: {
                            beforestatesave: {
                                fn: me.onPanelBeforeStateSave,
                                scope: me
                            }
                        }
                    }
                ],
                listeners: {
                    afterrender: {
                        fn: me.onViewportAfterRender,
                        scope: me
                    }
                }
            });
    
    
            me.callParent(arguments);
        },
    
    
        onPanelBeforeStateSave: function(stateful, state, options) {
            alert("state");
        },
    
    
        onViewportAfterRender: function(abstractcomponent, options) {
            Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
        }
    
    
    });





    HELPFUL INFORMATION


    Debugging already done:
    • none

    Possible fix:
    • not provided

    Additional CSS used:
    • only default ext-all.css

    Operating System:
    • Win7 Pro 64bit

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,909
    Vote Rating
    626
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      1  

    Default


    You're missing the stateful config:

    Code:
    Ext.define('MyApp.view.MyViewport', {
        extend: 'Ext.container.Viewport',
    
        layout: 'fit',
    
        initComponent: function() {
            var me = this;
    
            me.items = [{
                xtype: 'panel',
                stateful: true,
                stateId: 'myPan',
                collapsible: true,
                title: 'My Panel'
            }];
    
            me.callParent(arguments);
        }
    });
    
    Ext.require('*');
    
    Ext.onReady(function() {
        Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
        new MyApp.view.MyViewport();
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    6
    Vote Rating
    0
    A.Wagner is on a distinguished road

      0  

    Default


    I used Sencha Architect 2 to implement the code above.

    I guess that the stateful: true is the default value, isn't it???

  4. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    6
    Vote Rating
    0
    A.Wagner is on a distinguished road

      0  

    Default


    So I put the stateful config manually and now it works. So may the Sencha Architect should be changed that way.

    Thanks for your help.

  5. #5
    Sencha User
    Join Date
    Sep 2012
    Posts
    1
    Vote Rating
    0
    bpmportal is on a distinguished road

      0  

    Default Collapse state is maintained but not able to expand it again.

    Collapse state is maintained but not able to expand it again.


    Hello,

    I was testing this issue mentioned. The collapse state is maintained and it's working fine as expected.
    But if I click on expand button it's not getting expanded.

    Steps followed:
    1) Opened the page.
    2) Collapsed the panel.
    3) Reload the page.
    Now the panel is rendered in collapsed state (since the previous state was collapsed) as expected.
    4) Click on expand button.

    I have faced the same issue with the different test code as follows.

    Code:
    Ext.onReady(function() {
    
    
    Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
        var panel1 = Ext.create('Ext.Panel', {
            title: 'TestTitle',
            collapsible: true,
            stateful: true,
            stateId: 'teststateid',
            stateEvents: ['collapse', 'expand'],
            getState: function() {
              this.isCollapsedBefore =  this.collapsed;
              return {
                 isCollapsed: this.collapsed
              };
            },
            applyState: function(state) {
                if(state.isCollapsed) {
                    this.collapse();
                }        
            },
            items: [{xtype:'button', text: 'button1'}, {xtype:'button', text: 'button2'}],
            renderTo: Ext.getBody()    
        });
        
    });
    Note:
    - I'm not sure whether I'm doing the correct way to do it. Please suggest me the best way to do that.

    Please check the code and provide the best solution to reach this requirement.


    Thanks,
    Amal

  6. #6
    Ext Premium Member Jan (HL)'s Avatar
    Join Date
    Aug 2010
    Location
    Germany
    Posts
    111
    Vote Rating
    9
    Jan (HL) will become famous soon enough

      0  

    Default


    Tip: Check your domain's cookie size. There exists several different size limits in the browsers.