I'm running into the problem with Anchor widgets trying to reload the browser when clicked... After searching the forums I've seen the various workaround people are using but none seem applicable. Maybe someone has any ideas?
What I have is a Composite that implements HasClickHandlers... This Composite basically contains some textual display info and an edit link and are created and added by its parent widget and presented to the user. As a parent creates these composites it adds a click handler to them and to see if the user hits the edit button.
Relevant code:
public class CategoryPromoLink extends Composite implements HasClickHandlers {
...
...
// constructor:
CategoryPromoLink(String categoryDirectoryName, String categoryDisplayName, String heading, String annotation, String startTime, int rank) {
this.categoryDirectoryName = categoryDirectoryName;
this.categoryDisplayName = categoryDisplayName;
this.heading = heading;
this.annotation = annotation;
this.startTime = startTime;
this.rank = rank;
this.initWidget(this.root);
this.display = new InlineLabel("- " + (categoryDisplayName.trim().equals("") ? "[UNKNOWN CATEGORY]" : categoryDisplayName));
this.root.add(this.display);
Anchor edit = new Anchor("(edit)");
edit.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
CategoryPromoLink.this.fireEvent(event);
}
});
this.root.add(edit);
}
...
...
@Override
public HandlerRegistration addClickHandler(ClickHandler handler) {
return this.addHandler(handler, ClickEvent.getType());
}
}
Works fine in all but IE, where when the "edit" anchor is clicked it tries to reload page (in my case since i'm using GWT Activities with an "onMayStop" implementation its asking the user if they want to leave or stay on this page).
Should i not be using ClickHandlers and/or Anchors this way?
Thanks.
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment