On 15 avr, 15:25, dayre <david.c.a...@gmail.com> wrote:
> HI Vitali,
>
> Thank you for taking the time to respond.  I very much appreciate it.
>
> The reason i'm not using existing GWT widgets, which my example
> doesn't show, is because i'm trying to attach an onclick() event to
> ordered list items (<li>text</li>).   There doesn't seem to be a
> widget which easily allows for this.   Someone else in this group had
> suggested they do what i was trying to do.   I'm trying to port an
> existing interface which i did in jquery() to GWT... one of the key
> components uses plain list items which i attach listeners to.

While the JSNI path is (more than) OK when prototyping your port, I'd
recommend you create a widget that suits your needs instead.
You could also (now, or as part of the widget) take advantage of event
bubbling: register a ClickHandler at the container level, look at the
ClickEvent.getNativeEvent().getEventTarget() (it should be an Element,
check with Element.is(...) and cast with Element.as(...)) and walk up
the tree (getParent) until you find a LI (elem.getTagName
().equalsIgnoreCase(LIElement.TAG)) or your widget's element
(getElement()). FYI, that's what the grids (Grid and FlexTable) in GWT
do for the "cell click" events.

> What you explain makes sense and your option #2 for using the jsni
> name of the java function seems the easiest.

I doubt it'll work (I'm almost sure it won't; JSNI reference resolving
is done by parsing the JavaScript code, not using regexes and find/
replace).



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to