Results 1 to 7 of 7

Thread: Extjs 4.2 Stateful grid on Ext.window.Window

  1. #1

    Default Extjs 4.2 Stateful grid on Ext.window.Window

    Hi everyone.My Extjs version is 4.2. I try save state of the grid, which is item of window.When I close window state of the grid save in cookies, but it don't restore when window open again. What did I miss?
    This is my code:
    Code:
    Ext.onReady(function(){
    
        Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));
    
        Ext.create('Ext.data.Store', {
            storeId:'simpsonsStore',
            fields:['name', 'email', 'phone'],
            data:{'items':[
                { 'name': 'Lisa',  "email":"[email protected]",  "phone":"555-111-1224"  },
                { 'name': 'Bart',  "email":"[email protected]",  "phone":"555-222-1234" },
                { 'name': 'Homer', "email":"[email protected]",  "phone":"555-222-1244"  },
                { 'name': 'Marge', "email":"[email protected]", "phone":"555-222-1254"  }
            ]},
            proxy: {
                type: 'memory',
                reader: {
                    type: 'json',
                    root: 'items'
    }
            }
        });
    
        Ext.create('Ext.container.Viewport', {
    
            items: [
                Ext.create('Ext.Button', {
                    text: 'Click me',
                    listeners:{
                        'click':function(){
    
                            var grid  = Ext.create('Ext.grid.Panel', {
                                title: 'Simpsons',
                                store: Ext.data.StoreManager.lookup('simpsonsStore'),
                                columns: [
                                    { text: 'Name',  dataIndex: 'name' },
                                    { text: 'Email', dataIndex: 'email', flex: 1 },
                                    { text: 'Phone', dataIndex: 'phone' }
                                ],
    
                                stateful:true,
                                stateId:'some_state_id'
    });
    
                            var win = Ext.create('Ext.window.Window', {
                                title: 'Hello',
                                height: 200,
                                width: 900,
                                layout: 'fit',
                                items: grid
    });
    
                            win.show();
                        }
                    }
                })
            ]
        });
    })

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Which specific version of Ext JS 4.2 are you using? You code seems to recall the sorting I selected. How is it failing for you?

  3. #3

    Default

    Version is 4.2.2.1144. I replaced columns and changed them size. But state (size,orders) of the columns do not restore. I thought that if 'stateId' do not change the state of grid columns must be restore when window opens

  4. #4
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Ah, I see that now. Looks like a bug which isn't fixed until 6.0.1. I searched for a matching bug ticket to see about a workaround but couldn't find one.

  5. #5

    Default

    Could you make the bug ticket at the sencha bugtracker? Or i need do it myself? Is it possible that the bug will be fixed because version is 4.2 (4.2 is old version)?

  6. #6
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Support for Ext JS 4.x ended on December 31st, 2016.

  7. #7
    Sencha User
    Join Date
    Apr 2015
    Posts
    2

    Default

    I know this topic is old but might help someone...
    Had same issue with Ext JS 5.x

    Had statefulness set up for window and grid that were created on open (stateful: true, stateId: 'someId' ) and then destroyed on close.
    The problem was that on open each column in grid got a new ID and although state information was stored by statemanager (checked by Ext.state.Manager.get('someId')), the new column ID did not match.

    To fix I had to set stateId for each column also.

Similar Threads

  1. stateful window position?
    By lrayman in forum Ext: Q&A
    Replies: 2
    Last Post: 20 Mar 2014, 8:48 AM
  2. Replies: 5
    Last Post: 15 Oct 2013, 2:53 AM
  3. [Ext 4.1] stateful window
    By codeworx in forum Ext:Bugs
    Replies: 3
    Last Post: 14 Jun 2012, 11:04 PM
  4. Replies: 2
    Last Post: 9 May 2012, 6:12 AM

Posting Permissions

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