Thursday, April 16, 2015

SafeHtmlCell column is not firing the handler onBrowserEvent

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 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.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment