1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    22
    Vote Rating
    0
    Aurélien Warnon is on a distinguished road

      0  

    Default Window hide method sets position to -10000

    Window hide method sets position to -10000


    I can't really make a test case for this issue so I'll try to explain it the best way I can.

    Here is the context of my problem:

    In our application we have filter windows that allow users to filter grid data based on some parameters. The state of these windows are kept in our database to keep the same grid data between two visits of the page. So, whenever the 'ok' button of the window is clicked, we trigger the saving of the state and we hide the window to load the grid data. We have a delay of 2 seconds to avoid having too many requests sent to the server. The HttpProvider is defined that way:

    Code:
    Telefleet.initStateProvider = function(config) {
        Ext.state.Manager.setProvider(new Ext.ux.state.HttpProvider({
            url: serverUrl,
            delay: 2000,
            autoRead: false,
            logFailure: true,
            logSuccess: false}
        ));
        
        Ext.state.Manager.getProvider().initState(config.initState);
    };
    Now that you have the context, here is the problem:

    In 4.0.7, the getState method of Ext.window.Window saved the correct position of the window even though it was already hidden (because of the 2 seconds delay).

    In 4.1.1, the same method saves a position of {x: -10000, y: -10000}, because it takes the position of the hidden window. So, when the state restores, it immediately hides it...

    Is this new behavior a bug or is it done on purpose ?
    If so, please give me some advise to still save the "good" position of the window (I mean before it's hidden).

    PS: Please tell me if I haven't made myself clear enough.

  2. #2
    Sencha User
    Join Date
    Mar 2011
    Posts
    22
    Vote Rating
    0
    Aurélien Warnon is on a distinguished road

      0  

    Default


    It feels like no one has the slightest clue what I'm talking about..

  3. #3
    Sencha User
    Join Date
    Feb 2008
    Posts
    49
    Vote Rating
    3
    urban.novak is on a distinguished road

      0  

    Default


    Quote Originally Posted by Aurélien Warnon View Post
    It feels like no one has the slightest clue what I'm talking about..
    Don't worry, I'm sure that Sencha developers know exactly what you are talking about, they just ignore you.

    Anyway, you can try changing window hideMode config option to 'visibility' or 'display'.

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,982
    Vote Rating
    453
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Setting the mode to 'visibility' will display preserve the correct values.

    Code:
    Ext.onReady(function(){
    
        var win = Ext.create('Ext.window.Window', {
            title: 'Hello',
            height: 200,
            width: 400,
            layout: 'fit',
            hideMode: 'visibility',
            items: {  
                xtype: 'grid',
                border: false,
                columns: [{header: 'World'}],
                store: Ext.create('Ext.data.ArrayStore', {})
            }
        }).show();
    
        win.hide();
        console.log(win.x+','+win.y);
        console.log(win.getState());
     
    });
    Scott.

  5. #5
    Sencha User
    Join Date
    Mar 2011
    Posts
    22
    Vote Rating
    0
    Aurélien Warnon is on a distinguished road

      0  

    Default


    It does the trick, thanks to you both !

  6. #6
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    378
    Vote Rating
    2
    silcreval is on a distinguished road

      0  

    Default


    I've had similar problems restoring a complex application with several windows from a state. In 4.0.7 the z-order is remembered correctly, but in 4.1 it gets lost, and in fact the top most window is always the last to update/redraw.