Monday, January 12, 2015

How to add back the “loading” Element after removed it from Parent?

Ok, in war/MyProject.html, I have:

<body>     <div id="loading">             <div id="waitingForLoading"></div>              <BR/>          <img src="../images/loading.gif" />      </div>  ...  </body>  

in MyProject.java

public class OfflineMatching implements EntryPoint {     @Override     public void onModuleLoad() {          // this code works fine          if(DOM.getElementById("loading")!=null){                DOM.getElementById("loading").removeFromParent();          }              Button myButton=new Button("Enter Main Page");          RootPanel.get().add(myButton);          myButton.addClickHandler(new ClickHandler(){               @Override             public void onClick(ClickEvent event) {                 // this code does not work                 if(DOM.getElementById("loading")==null){                   DOM.appendChild(RootPanel.getBodyElement(), DOM.createElement("loading"));                 }             }          });     }  }  

So, did i do anything wrong? Why this code does not work?

 // this code does not work             if(DOM.getElementById("loading")==null){               DOM.appendChild(RootPanel.getBodyElement(), DOM.createElement("loading"));             }  

http://stackoverflow.com/questions/27901577/how-to-add-back-the-loading-element-after-removed-it-from-parent

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment