Greetings,
First off, the sample I'm describing here is just a trimmed down version of
what I'm really going for. What I'm really trying to do is put a FileUpload
widget (gwtupload) inside a Cell so for each row within the table, the user
can select one or more files and upload them. I know one wouldn't typically
do what I'm describing here because there are other Cell widgets available
that cover it. I've just trimmed it down to this to try and make sure I
understand what I can/can't do in an AbstractCell. When I saw this behavior
as I was trying to use the file upload widget from gwtupload, I simplified
it to try and get an idea as to where the issue might be. The bottom line
is it appears as though when creating an AbstractCell that contains a
button, I am unable to get the button to fire it's click handler. Here's
some sample code that should demonstrate what I'm trying to do in this
narrowed down case:
My AbstractCell:
private static class AbstractButtonCell extends AbstractCell<String> {
@Override
public void render(com.google.gwt.cell.client.Cell.Context context,
final String value, SafeHtmlBuilder sb) {
if (value == null) {
return;
}
VerticalPanel buttonPanel = new VerticalPanel();
Button addLinkButton = new Button("Click " + value);
addLinkButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
Window.alert("You clicked " + value);
}
});
buttonPanel.add(addLinkButton);
sb.appendHtmlConstant(buttonPanel.toString());
}
}
My column that's using the AbstractCell above:
AbstractButtonCell buttonCell = new AbstractButtonCell();
Column<SimilarApplication, String> buttonColumn =
new Column<SimilarApplication, String> (buttonCell) {
@Override
public String getValue(SimilarApplication object) {
return object.getName();
}
};
_cellTable.addColumn(buttonColumn, "A Button");
So, when the cell renders, it's got a button in it that says "Click
<whatever comes from object.getName()". However, when I click the button,
it's onClick handler doesn't seem to fire. I've looked through several
other posts that discuss AbstractCells but I haven't been able to find one
that describes quite what I'm seeing.
Any thoughts or suggestions would be greatly appreciated. Thanks.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/FHDa0IaRZUkJ.
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.