Wednesday, March 9, 2011

Button click event handling in a FlexTalbe using MVP (GWT 2.2)

Hello,

I am having some trouble with handling button click event when the
button is a widget of a FlexTable utilizing MVP framework. Getting a
selected row of the FlexTable is well explained as tutorial source
code, but button click event is not. The buttons are created
dynamically when the FlexTable is loaded. I am not quite sure how I
can link those buttons with the event handler.

When using MVP framework,

In MyView.java,

public class MyView extends Composite implements MyPrensenter.Display
{
private FlexTable containerTable;
private FlexTable contentsTable;

public MyView() {

...

containerTable.setWidget(1,0, contentsTable);

}

public HasClickedHandlers getList() {
return contentsTable;
}

public void setData(List<String> data) {
contentsTable.removeAllRows();

for(int i=0; i<data.size(); ++i) {
contentsTable.setWidget(i, 0, new data.get(i)); // get some
data as text
contentsTable.setWidget(i, 1, new Button("Edit");
}
}

}

setData(List<String>) sets table by querying database when the MyView
is created. By having HasClickedHandlers getList(), click event for
contentsTable is handled. But I am not fully clear how the event
handler can be defined for the buttons of contentsTable.

I am pretty sure that I can handle those buttons of FlexTable while
using MVP. But I think I need some help with this. Help will be
greatly appreciated. Thanks :)

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate