Hi Jason.

This is definitely the easier and faster solution. :)
I don't even know why I came up with the DOM iterating stuff...

/Phil

On Jul 31, 4:55 pm, Jason Essington <jason.essing...@gmail.com> wrote:
> wouldn't it be easier (and perhaps faster) to do something like:
>
>    RootPanel rp = RootPanel.get("sample");
>    rp.clear(); // remove any widgets to be safe
>    rp.getElement().setInnerHTML(""); // and clear any remaining contents
>
> -jason
> On Jul 30, 2009, at 1:55 AM, Thamizharasu S wrote:
>
>
>
>
>
> > Hi Phil,
>
> > This is working fine. Thanks for your answer.
>
> > On Jul 27, 3:18 pm, Phil <couch...@googlemail.com> wrote:
> >> 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 completelyclearthe 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 <zaru...@gmail.com> 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 toclearall 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 Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to