我有一個CellTable,需要一個帶有超鏈接和單元格內的onclick處理程序的列。 1日問題,如果我有什麼做錯了:在表格單元格中創建鏈接,並通過點擊它打開浮動彈出框
Column<MyObject, Anchor> linkColumn = new Column<MyObject, Anchor>(
new AnchorCell()) {
@Override
public Anchor getValue(final obj) {
Anchor link = new Anchor("link");
link.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Window.alert("clicked ");
}
});
return link;
}
};
cellTable.addColumn(linkColumn, "link column");
...
public class AnchorCell extends AbstractCell<Anchor> {
@Override
public void render(Context context, Anchor h, SafeHtmlBuilder sb) {
sb.append(SafeHtmlUtils.fromTrustedString(h.toString()));
}
}
- 但點擊鏈接 - 偏偏不信邪
和第二個問題:什麼是更好的方式來打開浮動(基於div左右,而不是分開的瀏覽器窗口)pupup與來自該ClickHandler的文本內容?
我只需要處理表格單元格中鏈接的單擊事件。在普通的html/js中,我有. How can I get it with GWT - adding Anchor widget to the table or coding onBrowserEvent? – yetanothercoder
You can always just add your plain html from the renderer - you don't need a widget. 'sb.append(SafeHtmlUtils.fromTrustedString(""));' –
I see, thanks. But it's a way back to html/js programming what GWT is opposed to... so I'm puzzled: if there really no standard way in GWT to do just