views:

41

answers:

1

Hi All,

I am retrieving a List<String> strings from my database and i would like to display it in a Flex Table.Also with every row in the flex table i want a delete button.The delete button on click should remove the row from the flex table.

so i write code some thing similar to

for(int i =0 ;i < strings.size();i++) {

flexTable.setWidget(i,0,strings.get(i));
flexTable.setWidget(i,1,new Button("X");

}

Now i am using MVP architecture to write this code.The reason why i am specifying this is i want all the widgets declared in my View and the click handlers to be in my presenter.

Generally if i have Button b = new Button("Sample Button"); in my View

I can have a getter method and use getButton.addClickHandler(new ClickHandler()) in my presenter. But here i am creating delete buttons on fly.

So how can i assign a click handler to the delete Button and onClick i should be able to remove the row from the flextTable.

Thanks

A: 

Just register the handlers in the View and provide a Callback type class from the Presenter that receives each String that is deleted.

Finbarr
Can you be a bit more clear please
bhargava