0
我正在GWT中的CustomDataGrid中工作。我想要做一个可点击的列,使用TableCellBuilder.I做了一个锚点元素并在其中添加了一个点击处理程序。下面是我的代码如何将点击处理程序添加到在GWT中的Tablecell中添加的锚点元素?
/**
* Builds cells of the details shown when main service category is clicked
*
* @author smrita
* @param rowValue
* : A <link> String </link> which is the value of each cell
* @param cellStyles
* : A<link>String</link> which is the style of each cell.
*/
public void buildEachServiceCommissionCell(String rowValue, String cellStyles) {
TableRowBuilder detailCell = startRow();
TableCellBuilder td = detailCell.startTD();
cellStyles = cellStyles + " " + resources.esewaCss().commissionListDataGridChildRows();
td.className(cellStyles);
td.style().outlineStyle(OutlineStyle.NONE).endStyle();
Anchor removeAnchor = new Anchor(rowValue);
removeAnchor.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent arg0) {
Window.alert("clicked");
}
});
td.html(new SafeHtmlBuilder().appendHtmlConstant(removeAnchor.toString()).toSafeHtml());
detailCell.endTD();
}
}
但是,当我点击锚元素,点击事件没有被处理(因为警报没有来)。我在这里错过了什么?