1. #1
    Ext GWT Premium Member
    Join Date
    Jul 2009
    Posts
    56
    Answers
    1
    Vote Rating
    0
    kaushikGXT is on a distinguished road

      0  

    Default Unanswered: Inserting a component into an Div

    Unanswered: Inserting a component into an Div


    I am trying to create a div and insert a component into the div by as follows and have not been successful. What is it that I am doing incorrectly?

    HorizontalPanel hp = new HorizontalPanel();
    Html myHtml = new Html("<div id=\"htmlDiv\""></div>");
    Label myLabel = new Label("Name");

    hp.add(myHtml);
    RootPanel.get("htmlDiv").add(myLabel);

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Answers
    60
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    RootPanel.get("htmlDiv").add(myLabel);
    That will only work, when the element with the id "htmlDiv" is already in the page.

  3. #3
    Ext GWT Premium Member
    Join Date
    Jul 2009
    Posts
    56
    Answers
    1
    Vote Rating
    0
    kaushikGXT is on a distinguished road

      0  

    Default


    Is there any other way to add the new Html element and to induce a component into it? Would forcing the hp.layout() help?

    HorizontalPanel hp = new HorizontalPanel();
    Html myHtml = new Html("<div id=\"htmlDiv\""></div>");
    Label myLabel = new Label("Name");

    hp.add(myHtml);
    hp.layout();
    RootPanel.get("htmlDiv").add(myLabel);

    Thanks,
    Kaushik

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Answers
    60
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Another solution would be to use HtmlContainer. However this depends on your exact requirements.

  5. #5
    Ext GWT Premium Member
    Join Date
    Jul 2009
    Posts
    56
    Answers
    1
    Vote Rating
    0
    kaushikGXT is on a distinguished road

      0  

    Default


    I tried to add the label to the div, after the page was rendered and still could not find the div on the page.

    private HorizontalPanel getHP(){

    HorizontalPanel hp = new HorizontalPanel();

    Html myHtml = new Html("<div id=\"htmlDiv\""></div>");
    hp.add(myHtml);
    return hp;
    }
    @Override
    protected void afterRender() {
    // TODO Auto-generated method stub
    Label listLabel = new Label("Sort By:");
    listLabel.setId("listLabelId");
    if (RootPanel.get("leftDiv") != null){
    RootPanel.get("leftDiv").add(listLabel);
    } else {
    Window.alert("Cannot find the div");
    }
    }


    Is there anything else that I need to be looking into.

  6. #6
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Answers
    60
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Can you please provide a fully working testcase implementing EntryPOint? From what are you overrding afterRender?

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi