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() {
    this(SimpleSafeHtmlRenderer.getInstance());
  }

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

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

  @Override
  protected void render(Context context, SafeHtml value, SafeHtmlBuilder sb) 
{
    if (value != null) {
      sb.append(value);
    }
  }
}

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.as(eventTarget))) {
>             Element el = Element.as(eventTarget);
>             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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to