Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • setID does not seem to 'stick'

    Browser: Firefox 52.0
    Smartgwt : Version 6.1p, Built 2017-09-05
    GWT: 2.7

    I want to set the ID of my VLayout so I can retrieve the component later on using that ID.

    For example...I want to be able to do

    VLayout mycomponent = (VLayout)Canvas.getById("mycontainer");


    Here is a sample code;


    MyProject.java

    public class MyProject implements EntryPoint {

    public void onModuleLoad() {
    VLayout mainContainer = new VLayout();
    mainContainer.setWidth(800);
    mainContainer.setHeight(500);
    mainContainer.setID("mycontainer");
    RootPanel.get("mainContainer").add(mainContainer);
    SC.say("MainContainer id="+mainContainer.getID()); // this is NOT equal to 'mycontainer'

    }


  • #2
    See QuickStart Guide and FAQ - do not use RootPanel.add() unless forced to do so. This is one of several lifecycle issues that may result, because SmartGWT and GWT do not render DOM elements at the same times (SmartGWT performs rendering more “lazily” for performance reasons).

    Comment

    Working...
    X