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

15,166

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.
  }
});
Share:
15,166
Noor
Author by

Noor

Love programming, designing system, their architectures, fond of client side web programming using javascript frameworks such as angularjs, emberjs or other like GWT

Updated on July 16, 2022

Comments

  • Noor
    Noor almost 2 years

    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?

  • Noor
    Noor over 13 years
    but how to place regular button in cell table??
  • HaveAGuess
    HaveAGuess over 12 years
    redrawButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { contactList.redraw(); } });