表格和分页
如有任何想法,将不胜感激。
要求
(A) 一个表,其中包含
A.1 text columns
A.2 one column for HTML content
A.3 one column to house a radio button group
(B) 能够对记录进行分页,例如通过使用 SimplePager。
到目前为止考虑的替代方案
- FlexTable - 可以提供 (A) 的所有内容,但不能提供 (B)
- CellTable - 可以提供 A.1 和 (B),但不能提供 A.2 或A.3
谁能提出一个提供所有 A 和 B 的替代方案?我也看过 Smart GWT,但没有看到任何我可以使用的东西。但我对 GWT 或 Smart GWT 都不是很有经验。
谢谢。
[编辑 1] 现在创建的具有三个按钮的单选按钮组如下(“InterimReport”是我的数据类型):
Column<InterimReport, SafeHtml> radioButtonColumn = new Column<InterimReport, SafeHtml>(new SafeHtmlCell()) {
@Override
public SafeHtml getValue(InterimReport object) {
String s = "<input type=\"radio\" name=\"selection\"" + object.get("dbIndex") + " value=\"match\" /> match<br />"+ "<input type=\"radio\" name=\"selection\"" + object.get("dbIndex")+ " value=\"nomatch\" /> no match<br />" + "<input type=\"radio\" name=\"selection\""+ object.get("dbIndex") + " value=\"urlnotfound\" /> URL not found</>";
return SafeHtmlUtils.fromTrustedString(s);
}
};
[编辑 2] 但是如何捕获用户对单选按钮的选择?此代码片段似乎没有执行任何操作:
radioButtonColumn.setFieldUpdater(new FieldUpdater<InterimReport, SafeHtml>() {
public void update(int index, InterimReport object, SafeHtml value) {
System.out.println("Reached here");
if (value.equals("match")) {
setMatch(object.get("dbIndex"), index);
} else if (value.equals("nomatch")) {
setNoMatch(object.get("dbIndex"), index);
} else if (value.equals("urlnotfound")) {
setUrlNotFound(object.get("dbIndex"), index);
}
}
});
Would be grateful for any ideas.
Requirement
(A) a table containing
A.1 text columns
A.2 one column for HTML content
A.3 one column to house a radio button group
(B) the ability to page through the records, e.g. by use of SimplePager.
Alternatives considered so far
- FlexTable - can provide all of (A) but not (B)
- CellTable - can provide A.1 and (B), but not A.2 nor A.3
Can anyone suggest an alternative(s) that provides all of A and B? I have looked also at Smart GWT but don't see anything I can use. But I'm not very experienced in either GWT or Smart GWT.
Thank you.
[edit 1] Radio button group with three buttons now created as follows ('InterimReport' is my data type):
Column<InterimReport, SafeHtml> radioButtonColumn = new Column<InterimReport, SafeHtml>(new SafeHtmlCell()) {
@Override
public SafeHtml getValue(InterimReport object) {
String s = "<input type=\"radio\" name=\"selection\"" + object.get("dbIndex") + " value=\"match\" /> match<br />"+ "<input type=\"radio\" name=\"selection\"" + object.get("dbIndex")+ " value=\"nomatch\" /> no match<br />" + "<input type=\"radio\" name=\"selection\""+ object.get("dbIndex") + " value=\"urlnotfound\" /> URL not found</>";
return SafeHtmlUtils.fromTrustedString(s);
}
};
[edit 2] But how to capture the user's selection of a radio button? This code fragment doesn't appear to do anything:
radioButtonColumn.setFieldUpdater(new FieldUpdater<InterimReport, SafeHtml>() {
public void update(int index, InterimReport object, SafeHtml value) {
System.out.println("Reached here");
if (value.equals("match")) {
setMatch(object.get("dbIndex"), index);
} else if (value.equals("nomatch")) {
setNoMatch(object.get("dbIndex"), index);
} else if (value.equals("urlnotfound")) {
setUrlNotFound(object.get("dbIndex"), index);
}
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
CellTable 可以保存 HTML 内容 (
SafeHtmlCell
),因此也可以保存单选按钮组。只需使用作为 HTML。您只是不能在 CellTable 中使用小部件 - 其他一切仍然可以工作。
(抱歉,未经测试的代码。也许我记错了方法签名或其他什么)
A CellTable can hold HTML content (
SafeHtmlCell
) and so can also hold a radio button group. Just use<input type="radio" name="whatever"/>
as the HTML. You just can't use Widgets in a CellTable - everything else will still work.(sorry, untested code. Maybe I misremember a method signature, or something)