Search code examples
domsmartgwt

SmartGWT find element by id


I want to embedded some smartgwt in a legacy-html-file ( can't change that ). Now I know that I can just say

BaseWidget.setHtmlElement(<element>)

The problem is finding the , it has a unique id, but the only thing I found that looks at the entire structure is

DOM.getElementById(<id>)

But this is GWT and not SmartGWT, isn't there a way to do this only with SmartGWT?


Solution

  • Using GWT's DOM.getElementById() method is fine. SmartGWT extends GWT. For core operations such as retrieving an element by ID, SmartGWT uses the GWT APIs because otherwise SmartGWT would just be duplicating functionality in GWT.

    DOM.getElementById() is a wrapper around GWT's Document.getElementById() method. SmartGWT's Showcase calls Document.getElementById() to hide the "Loading" message:
    https://code.google.com/p/smartgwt/source/browse/trunk/samples/showcase/src/com/smartgwt/sample/showcase/client/Showcase.java?r=2900#707