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();
}
}
但是,當我點擊錨元素,點擊事件沒有被處理(因爲警報沒有來)。我在這裏錯過了什麼?