Friday, July 2, 2010

getting the current row count from the button

Hello,

I have a simple problem. I am using GWT 2.0 and I need help.
I add a row with a button in FlexTable. The button should remove the
row when click.
But I didnt get current current row count..

private void addItem() {

// Add a button to remove this Item from the table.
final int itemRowCount = testFlexTable.getRowCount();
final Button removeStockButton = new Button("x");
removeStockButton.addStyleDependentName("remove");
removeStockButton.setTabIndex(itemRowCount);

removeStockButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
int removedIndex = // ****** I should get the current current row
count here *******
testFlexTable.removeRow(removedIndex);
}
});
testFlexTable.setText(itemRowCount, 0, "Test" + itemRowCount);
testFlexTable.setWidget(itemRowCount, 1, removeStockButton);

}

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment