window scrolls to top afte closing PaopupPanel

63 views
Skip to first unread message

Deepak Singh

unread,
Aug 12, 2012, 12:44:13 PM8/12/12
to google-we...@googlegroups.com
Hi All,

I have a popup panel and am showing some content inside it with scrolling enabled inside popupPanel.

Now the problem i am facing is that, 
after closing popupPanel(once it hides), the current Window automatically scrolls to top. I want the window should remain as it is even after closing popupPanel.



Thanks 
Deepak Singh

Deepak Singh

unread,
Aug 13, 2012, 2:06:30 PM8/13/12
to google-we...@googlegroups.com
Any suggestion how can i achieve this ?
--
Deepak Singh

Thad

unread,
Aug 13, 2012, 5:49:51 PM8/13/12
to google-we...@googlegroups.com
I've not seen this behavior. Perhaps if you provided more information or a code snippet? What version of GWT? In which browsers? What are the autoHide and modal settings for the panel?

Deepak Singh

unread,
Aug 14, 2012, 2:47:34 PM8/14/12
to google-we...@googlegroups.com
Hi,

I use following code :


int left = eachHotel.getAbsoluteLeft();
int top = eachHotel.getAbsoluteTop();
final DialogBox dialog = new DialogBox(true, true);
dialog.getElement().getStyle().setHeight(Window.getClientHeight() - 255, Unit.PX);
dialog.setPopupPosition(left, top);

$(dialog).as(Effects).fadeIn(100, new Function() {
@Override
public void f() {
dialog.show();
}
});
dialog.addCloseHandler(new CloseHandler<PopupPanel>() {
@Override
public void onClose(CloseEvent<PopupPanel> event) {
$(dialog).as(Effects).fadeOut(300, new Function() {
@Override
public void f() {
dialog.removeFromParent();
}
});
}
});

I am setting the position relative to some object(eachhotel).

Once the dialog closes, the Window scrolls to top.

Regards
Deepak


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/Uc8RqUBAHb0J.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
Deepak Singh

Deepak Singh

unread,
Aug 15, 2012, 3:09:47 PM8/15/12
to google-we...@googlegroups.com, gwtquery
Still the issue is not resolved. It happens on all browsers.

Any one  can figure out it.
--
Deepak Singh

Thad

unread,
Aug 16, 2012, 4:04:13 PM8/16/12
to google-we...@googlegroups.com, gwtquery
Sorry, I can't help you. That's far more complex than what I use. I've been sticking with the GWT API, something like:

final DialogBox dialog = new DialogBox(true, true);
// Create dialog contents--panel, text, buttons, etc
dialog.setGlassEnabled(true);
dialog.setAnimationEnabled(true); // I've not used this, but the code tells me that the default is 200.
dialog.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
  public void setPosition(int offsetWidth, int offsetHeight) {
    int left = eachHotel.getAbsoluteLeft();
    int top = eachHotel.getAbsoluteTop();
    dialog.setHeight((Window.getClientHeight() - 255)+"px");     
    dialog.setPopupPosition(left, top);      
  }
});

Somewhere in my dialog I may have one or more buttons whose onClick() ends with dialog.hide(). I've never called removeFromParent()

My window has not scrolled, regardless of where inside it I've placed my popup.
Reply all
Reply to author
Forward
0 new messages