Guys, I've been using a very simple Row Highlighter mixin for Grid components for a while and only now I ran into an issue - it won't work when there's another DIV element placed in the TML file before the Grid itself. The reason is obvious - the mixin will try to locate the Grid's table body using Element.find("div/table/tbody")... But I don't know what a proper way to do this would be?
The code of the mixin is very simple, as the mixin class consists of a single method: @AfterRender void after(MarkupWriter writer) { Element tbody = writer.getElement().find("div/table/tbody"); if (tbody != null) { for (Node rowNode : tbody.getChildren()) { if (rowNode instanceof Element) { ((Element) rowNode).attribute("onMouseOver", "this.style.background='#82C7FD';"); ((Element) rowNode).attribute("onMouseOut", "this.style.background='';"); } } } } Now, I would have expected the writer.getElement() to return the current element - for example the Grid's outer DIV element. But what it returns is the wrapper DIV found in the Border component - the DIV that contains the whole page. So it is obvious that the "div/table/tbody" path will match the first DIV within a page, and if it's not a Grid - and thus doesn't contain a table, it will fail (tbody will be null). But I don't know how to get hold of the right element here - that would be the Grid that this mixin is tied to. I've tried using: @InjectContainer private Grid element; This way I can get a Grid instance but I don't really know how to get an Element instance from here. Any ideas/clues will be highly appreciated! Thanks, Rado --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org