Thursday, April 23, 2015

Re: SafeHtmlCell column is not firing the handler onBrowserEvent

SafeHtmlCell doesn't consume event. If you want to catch some event, you can't use it !

Here a sample of my TouchTextCell :

public class TouchTextCell extends AbstractSafeHtmlCell<String> {
public TouchTextCell() {

public TouchTextCell(SafeHtmlRenderer<String> renderer) {
super(renderer, TouchBrowserEvents.TOUCHSTART, TouchBrowserEvents.TOUCHMOVE, TouchBrowserEvents.TOUCHEND);

public void onBrowserEvent(Context context, Element parent, String value, NativeEvent event, ValueUpdater<String> valueUpdater) {
super.onBrowserEvent(context, parent, value, event, valueUpdater);
(context, parent, value, event, valueUpdater);
protected void onEnterKeyDown(Context context, Element parent, String value, NativeEvent event, ValueUpdater<String> valueUpdater) {
if (valueUpdater != null) {

protected void render(Context context, SafeHtml value, SafeHtmlBuilder sb) {
if (value != null) {

Then use a ValueUpdater to do what you want.

Le jeudi 16 avril 2015 14:18:27 UTC+2, Abdul a écrit :

In cell table column,i created a column of type SafeHtmlCell.Inside i overridden the getvalue()and onBrowserEvent() Method. But when i click the column its not firing the event.See the below

 @Override   public SafeHtml getValue(final Object object) {   SafeHtmlBuilder sb = new SafeHtmlBuilder();   sb.appendHtmlConstant("<B>");   sb.appendHtmlConstant(value);   sb.appendHtmlConstant("</B>");   sb.appendHtmlConstant("<i class='icon-pencil'></i></span>");   return sb.toSafeHtml();        }       @Override      public void onBrowserEvent(Context context, Element elem,                          Object object, NativeEvent event) {             if ("click".equals(event.getType())) {             EventTarget eventTarget = event.getEventTarget();              if (elem.isOrHasChild( {              Element el =;              if ("icon-pencil".equals(el.getClassName())) {                          Window.alert("Successfully clicked");                                                          }                                          }                              }                      }
How to solve this? Wether i need override render() Method as well?Any idea?

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
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment