Have a FlexTable with made up of two columns of data and a third
column with a button, that when clicked makes an asynchronous call and
removes the data from the session. My problem is that when I click the
button it refers to the info in the row above and not the same row
that the button is in. Why?

public class GroupDataAlertDataGrid extends FlexTable {

        private ClickListener dismissListener;
        private Button dismissButton;

    void addDataToFlexTable(final LocationsInfoDTO locationsInfoDTO)
    {
        int row = 0;

        for(final Info info : locationsInfoDTO.getInfos()){

                dismissButton = new Button("Dismiss", dismissListener);

                this.setWidget(row, 1, new Label(info.getLocationCode()));
                this.setWidget(row, 2, new Label(info.getClientName()));
                this.setWidget(row, 3, dismissButton);

                dismissListener = new ClickListener() {
                                public void onClick(Widget sender) {

        
GwtAlertServicesDelegate.getService().removeLocationInfoFromSession(info,
                                                        new 
AsyncCallback<LocationsInfoDTO>() {
                                                                @Override
                                                                public void 
onFailure(Throwable arg0) {}
                                                                @Override
                                                                public void 
onSuccess(LocationsInfoDTO arg0) {}
                                                    }
                                        );
                                }
                        };
                row++;
        }
    }
}

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

Reply via email to