1 Reply Latest reply: Mar 29, 2013 10:22 PM by Mike Brock RSS

tweeter bootstrap table - how to add rows?

Anton Hughes Novice

HI

 

Im using tweeter bootsrap and am using Errai-UI

 

I'm struggling to figure out how to add rows, and ultimately, data bind to the table.

 

My latest attempt, which is not yielding results, is:

 

 

package app.client.local;


import javax.annotation.PostConstruct;
import javax.enterprise.context.Dependent;
import javax.inject.Inject;


import org.jboss.errai.ui.shared.api.annotations.DataField;
import org.jboss.errai.ui.shared.api.annotations.Templated;


import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;




@Dependent
@Templated("StrategiesTable.html")
public class StrategiesTable extends Composite {
  
          @DataField
          Element  table = DOM.createElement("table");
  
          @DataField
          Element  row = DOM.createElement("tr");


          @PostConstruct
          private void setup() {
                    table.appendChild(row);
                    table.appendChild(row);


          }


}

  • 1. Re: tweeter bootstrap table - how to add rows?
    Mike Brock Master

    You probably don't want your row being a @Datafield. Instead, you probably want to have code that looks something like this:

     

        @PostConstruct
              private void setup() {
                        table.appendChild(DOM.createElement("tr"));
                        table.appendChild(DOM.createElement("tr"));
              }

    You can't add a reference to the same node in multiple places in the DOM. This is as true in GWT and Errai as it is in JavaScript.