Announcement

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

    Uncaught JavaScript exception [uncaught exception: java.lang.AssertionError...

    Hello

    I am trying to put many component in a canvas and I have an error that I don't understand.
    I am using development mode plugin for eclipse and when I try to show my canvas I see nothing and in the console I have this message :

    Code:
    Uncaught JavaScript exception [uncaught exception: java.lang.AssertionError: A widget that has an existing parent widget may not be added to the detach list] in , line 0
    This is my class :

    Code:
    import com.google.gwt.user.client.ui.TextBox;
    import com.smartgwt.client.widgets.Canvas;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.HLayout;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    import fr.vif.vif5_7.browser.client.login.user.model.DataExampleUser;
    
    
    /**
     * TODO Write the class' description.
     *
     * @author sv2
     */
    public class FirstFunction extends Canvas {
    
        private VLayout  vlayout  = null;
    
        private ListGrid listGrid = new ListGrid();
    
        public FirstFunction() {
            super();
            initialize();
        }
    
        private void initialize() {
            this.addChild(getVLayout());
        }
    
        public VLayout getVLayout() {
            if (vlayout == null) {
                vlayout = new VLayout();
            }
            vlayout.setHeight("100%");
            vlayout.setWidth("100%");
    
            vlayout.addMember(getListGrid());
            vlayout.addMember(getUserFormLine());
    
            vlayout.draw();
            return vlayout;
        }
    
        public ListGrid getListGrid() {
            if (listGrid == null) {
                listGrid = new ListGrid();
            }
    
            ListGridField userCodeField = new ListGridField("codeUser", "Utilisateur");
            ListGridField userLabelField = new ListGridField("libelleUser", "Libelle");
                 
            listGrid.setFields(new ListGridField[] { userCodeField, userLabelField });
    
            listGrid.setData(DataExampleUser.getRecords());
            listGrid.setHeight("80%");
            listGrid.setWidth("100%");
            listGrid.setAlternateRecordStyles(true);
            return listGrid;
        }
    
        public HLayout getUserFormLine() {
            HLayout hlayout = new HLayout();
            com.smartgwt.client.widgets.Label lab = new com.smartgwt.client.widgets.Label("Utilisateur :");
            TextBox textBoxCode = new TextBox();
            hlayout.addMember(lab);
            TextBox textBoxLabel = new TextBox();
    
            hlayout.addMember(textBoxCode);
            hlayout.addMember(textBoxLabel);
            return hlayout;
        }
    
    }
    When I just add the ListGrid to the Canvas there is no problem but when i try to add my HLayout the error message appear.

    The message said a widget had already a parent but all my component just have one so I am a little lost.

    What could be wrong in my code?

    Thank you for any advice.

    #2
    I do have same problem now it is headace for me..

    Comment


      #3
      I have +- the same problem.

      Comment


        #4
        See FAQ - don't mix GWT and SmartGWT widgets expect in specific circumstances.

        Comment

        Working...
        X