How to get the "parent" element with GWT
errai, gwt, java
Solution
Need not to cast any thing.
you can do this:
home.getParent().getElement().setId("tray-active");
API
Problem
Say I have html part in my GWT application: ``` <ul> <li id="tray-active"><a data-field="home">Homepage</a></li> <!-- Active page --> <li><a data-field="news">News</a></li> <li><a data-field="products">Products</a></li> <li><a data-field="sales">General Sales T&C</a></li> <li><a data-field="job">Job Opportunities</a></li> </ul> ``` And I am able to get the AnchorElement, say for the HomePage: ``` @Inject @DataField Anchor home; ``` How can I get the List `li` element? Is it: `home.getParent(); // which returns a widget` ? Then cast it to a `UListElement` ? Is that it? Update: My main goal is to set the id of the `li` element to "tray-active", so when anchor item is clicked the "parent" `li` element is set to to "tray-active"