1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    15
    Vote Rating
    0
    lmcadory is on a distinguished road

      0  

    Default Create new instance of a widget from UiBinder field

    Create new instance of a widget from UiBinder field


    I have a TextField form inside a window. Created with UiBinding. Next to the TextField is a button. I wanted to know if it was possible to create a new TextField widget when that button was pressed using UiBinder?This is what I have:
    Window class:


    Code:
    @UiField
    TextField text;
    
    @UiField
    HorizontalPanel hPanel;
    ....
    @UiHandler("addText")
    public void onClick(SelectEvent event){
          hPanel.add(text);
    }
    My UiBinder file:


    Code:
    <gxt:Window ...(generic setup)...>
      <g:VerticalPanel>
        <gxt:FramedPanel>
          <container:VericalLayoutContainer>
            <container:child>
              <g:HorizontalPanel ui:field="hPanel">
                <form:FieldLabel text="Text">
                  <form:Widget>
                    <form:TextField ui:field="text"/>
                 </form:Widget>
                </form:FieldLabel>
                <button:TextButton ui:field="addText"/>
              </g:HorizontalPanel>
            </container:child>
           </container:VericalLayoutContainer>
         </gxt:FramedPanel>
        </g:VerticalPanel>
    </gxt:Window>

    When I click the button it all it does is move the button from the right side of the text field to the left. I have more textfields in the window so I played around to see what it was really doing. It's taking that field and just moving it next to the button.
    Is there a way I can create a new TextField underneath the original?

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Widgets can only be drawn in one place at a time, so adding it to a new position necessarily removes it from the old one. Instead, consider something like this in your uihandler:

    Code:
    hPanel.add(new TextField());
    You'll probably need some other specific wiring to keep track of this new field - if building an Editor, the ListEditor class might be helpful here to create multiple TextFields all bound to different entries in the List.

Thread Participants: 1

Tags for this Thread

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