[英]Adding a url column in celltable gwt
I'm workin on a web app using gwt, I have a celltable with textcolumns I want to add a column that will contain links, once the user clicks on a cell of this column he is forwaded to the link.我正在使用 gwt 开发一个 web 应用程序,我有一个带有 textcolumns 的单元格表,我想添加一个包含链接的列,一旦用户单击此列的单元格,他就会被转发到链接。
How can I do such a thing in gwt?我怎样才能在 gwt 中做这样的事情?
You would have to use a cell of appropriate type such as ClickableTextCell or ButtonCell as well as a FieldUpdater .您必须使用适当类型的单元格,例如ClickableTextCell或ButtonCell以及FieldUpdater 。
Basically you can add a FieldUpdater to your column as such:基本上,您可以将 FieldUpdater 添加到您的列中:
column.setFieldUpdater(new FieldUpdater<YourObject, String>() {
@Override
public void update(int index, YourObject object, String value) {
Window.open(value, "_blank", ""); //This will open link in a new tab or window
}
});
Where value in this case is the url.在这种情况下,值是 url。 update() will be called when the column is clicked.
单击该列时将调用 update()。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.