TCH
TCH

Reputation: 594

ExtJS Closing a window makes the screen scolling up

I created the following window in my code :

var window = Ext.create('Ext.window.Window', {
            name:'myWindow'
            ,id: 'myWindow'
            ,title: myTitle
            ,modal:true
            ,closeAction: 'destroy'
            ,constrainHeader: true
            ,items: [ myGrid ]
});
window.setPosition(e.getXY());

On my window I have severals item in a view and each item has a 'select' button on him. When I click on this button I have the following code :

itemclick: function(view, record, item, index, e, eOpts) {
    var window = me.up('#myWindow'); // me = the content panel in window
    window.close(); 
}

When .close() is called, the window is actually closed as I expect, but then the screen scrolls up to the top of the page and I really want to let the screen showing the section from where the window was displayed and NOT scrolling up. Thanks for any help !

Upvotes: 1

Views: 142

Answers (2)

TCH
TCH

Reputation: 594

Issue was from my html items in the window : They had a href=# which made the screen to scroll up ! I just removed it and it fixed my problem. Thanks !

Upvotes: 1

Salman hassan
Salman hassan

Reputation: 398

Use show(); instead of setPosition
i hope it will work just like worked for me

var window = Ext.create('Ext.window.Window', {
  name: 'myWindow',
  id: 'myWindow',
  title: myTitle,
  modal: true,
  closeAction: 'destroy',
  constrainHeader: true,
  items: [myGrid]
});
window.show();

Upvotes: 0

Related Questions