Hi Thamizharasu.
Panel.clear() does only remove child-widgets. As the innerHTML 'sample
content' is not considered a widget, it won't be affected.
You may do the following to completely clear the contents of your div
element:
---*snip*---
RootPanel samplePanel = RootPanel.get("sample");
// Clear
Element element = samplePanel.getElement();
NodeList<Node> childNodes = element.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
element.removeChild(childNodes.getItem(i));
}
---*snip*---
Regards,
Phil
On Jul 27, 6:37 am, Thamizharasu S <[email protected]> wrote:
> Hi All,
>
> I have defined one <div id="sample">sample content</div> control in
> static html file. In my Entry point class i have a button, if i click
> the button i have to clear all the contents from the <div> and put my
> own widget inside.
>
> So what i did was RootPanel.get("sample").clear(); Then i add my
> widget inside RootPanel.get("sample").add(widget);
>
> This is adding my new widget. But not clearing my old content (sample
> content) from the div.
>
> Could any one help me on this?
>
> Thanks,
> Thamizharasu S
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---