Reputation: 1189
I am learning GWT
In in first row of flexTable i have added combobox, combobox , text box , AddButton , Remove button.
On click event of addButton 2 row is added to the flexTable withe same component as first. ( combobox, combobox , text box , AddButton , Remove button.)
private Button getAddbutton() {
addbutton = new Button("");
addbutton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
int i = flexTable.getRowCount();
System.out.println(" i " + i);
i++;
flexTable.setWidget(i, 0, getPropertyList());
flexTable.setWidget(i, 1, getConditionList());
flexTable.setWidget(i, 2, getKeyWord());
flexTable.setWidget(i, 3, getAddbutton());
flexTable.setWidget(i, 4, getRemove());
remove.setStyleName("cmis-Button-removeOn");
remove.setTitle(""+i);
}
});
addbutton.setSize("25px", "25px");
addbutton.setStyleName("cmis-Button-Add");
return addbutton;
}
The output of i is
i 1
i 3
i 5
i 7
Why the rowCount is increasing by 2 though i have added only 4 rows in coloumn
Upvotes: 1
Views: 381
Reputation: 1419
his is because flexTable indexing starts from 0, but you are increasing the row count. so just remove i++.
Upvotes: 2