Hi Adam, What exactly is it that you are trying to achieve by doing this?
If you wish to find the cell that was clicked and manipulate it you can also do it this way : Add clickHandler to table/grid Call getSource() on received clickEvent Cast source to grid/flextable Call getCellForEvent(event) on the table which gives you a Cell element Then you can call row / cell index on the object and you would have your row / column. Cheers, Matt On May 7, 5:51 am, Adam <[email protected]> wrote: > Hey Gang, > > I've created a lightweight custom cell that extends AbstractCell. I've > included the code below. What I've determined is that the "parent" is > the DIV associated with the cell. What I'm trying to do is make it so > if I click anywhere in the cell including the text of the tds that the > onBrowserEvent is fired. I've figured out that what's happening is > that the click on the table I'm rendering or the tds is "swallowing" > the events of the div and therefore the onBrowserEvent isn't being > called. If this was a regular widget I'd just do a sinkEvent. The > issue I'm having is hope to sink the td mouse events into the cell > div. I looked at the source for AbstractCell and saw that public void > setValue(...) is calling render and also has access to the parent so > I've tried to do something like > > DOM.sinkEvent(parent.getFirstChildElement().getFirstChildElement().getFirstChildElement(), > > Event.ONCLICK). But that didn't see to do the trick either. Any > thoughts would be most appreciated. > > class OrderCell extends AbstractCell<MockOrder> { > public OrderCell() { > super("click", "keydown"); > } > > @Override > public void onBrowserEvent(Element parent, MockOrder value, > Object key, > NativeEvent event, ValueUpdater<MockOrder> > valueUpdater) { > super.onBrowserEvent(parent, value, key, event, valueUpdater); > if ("click".equals(event.getType())) { > onEnterKeyDown(parent, value, key, event, > valueUpdater); > } > } > > @Override > protected void onEnterKeyDown(Element parent, MockOrder value, > Object key, > NativeEvent event, ValueUpdater<MockOrder> > valueUpdater) { > if (valueUpdater != null) { > valueUpdater.update(value); > } > } > > @Override > public void render(MockOrder value, Object key, SafeHtmlBuilder > sb) { > // Value can be null, so do a null check.. > if (value == null) { > return; > } > > sb.appendHtmlConstant("<table>"); > > // Add the name and address. > sb.appendHtmlConstant("<tr><td>"); > sb.appendEscaped(value.getApplicant().getLastName() + ", " + > value.getApplicant().getFirstName()); > sb.appendHtmlConstant("</td></tr><tr><td>"); > sb.appendEscaped(value.getStatus()); > sb.appendHtmlConstant("</td></tr></table>"); > } > } -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
