Making a button fire inside a custom AbstractCell

Skip to first unread message

Tod Jackson

Jun 29, 2011, 10:00:39 AM6/29/11

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


public void render( context,

final String value, SafeHtmlBuilder sb) {

if (value == null) {



VerticalPanel buttonPanel = new VerticalPanel();

Button addLinkButton = new Button("Click " + value);

addLinkButton.addClickHandler(new ClickHandler() {

public void onClick(ClickEvent event) {

Window.alert("You clicked " + value);







My column that's using the AbstractCell above:

AbstractButtonCell buttonCell = new AbstractButtonCell();

Column<SimilarApplication, String> buttonColumn = 

new Column<SimilarApplication, String> (buttonCell) {


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.

Jun 29, 2011, 10:38:20 AM6/29/11
 you have not specified the events you want your cell to consume. You will have to add a constructor and specify the events you want  to consume

AbstractButtonCell() {
super(new String[] { "click", "keydown" });
//do rest of the init;


You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Tod Jackson

Jun 29, 2011, 11:01:54 AM6/29/11
Thanks for the reply.  Unfortunately, that doesn't seem to make any difference.  The CellTable I'm working with is in a custom DialogBox, I don't suppose that would make any difference would it?  I know I've had to do a little extra before when using DialogBoxes...perhaps I'll try to eliminate that as a possible culprit.  Thanks again.
Reply all
Reply to author
0 new messages