Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a click handler to the GWT ButtonCell?

I created a ButtonCell and a Column for it:

ButtonCell previewButton = new ButtonCell();
Column<Auction,String> preview = new Column<Auction,String>(previewButton) {
  public String getValue(Auction object) {
    return "Preview";
  }
};

How do I now add a click handler (e.g. ClickHandler) for this ButtonCell?

like image 529
Noor Avatar asked Dec 29 '10 17:12

Noor


1 Answers

The Cell Sampler example includes use of clickable ButtonCells. Clicks on ButtonCells are handled by setting the FieldUpdater for the Column:

preview.setFieldUpdater(new FieldUpdater<Auction, String>() {
  @Override
  public void update(int index, Auction object, String value) {
    // The user clicked on the button for the passed auction.
  }
});
like image 155
Jason Terk Avatar answered Oct 06 '22 08:10

Jason Terk