How to add clickhandler on ImageCell in GWT CellTable?

前端 未结 8 1327
再見小時候
再見小時候 2021-02-06 04:01

I have tried this but didn\'t work

Column imageColumn = new Column(new ImageCell()) {
       @Override
             


        
8条回答
  •  闹比i
    闹比i (楼主)
    2021-02-06 04:33

    public class ButtonImageCell extends ButtonCell{
    
        @Override
        public void render(com.google.gwt.cell.client.Cell.Context context, 
                String value, SafeHtmlBuilder sb) {
            SafeHtml html = SafeHtmlUtils.fromTrustedString(new Image(value).toString());
            sb.append(html);
        }
    }
    

    in use:

    final Column buttonImageCellTest = new Column(new ButtonImageCell()) {
        @Override
        public String getValue(ProxyObject row) {
            //url to image
            return row.getImageUrl();
        }
    };
    

提交回复
热议问题