The button is placed in each row in the FlexTable and removes that
particular row.
public class RemoveRowButtonClickHandler implements ClickHandler {
@Override
public void onClick(ClickEvent event) {
Cell cell = flexTable.getCellForEvent(event);
if(cell != null) {
removeRow(cell.getRowIndex());
}
}
}
On Jul 2, 5:52 pm, nasionalem <sakarya.me...@gmail.com> wrote:
> 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