问题描述
基本上,我想创建一个这样的表:我创建了一个网格,并添加了文本值和复选框。完全像在你的电子邮件箱中,你选择一些邮件,并删除它们或标记垃圾邮件。
这是我迄今为止所做的:
Grid grid = new Grid(4,3);
for(int i = 0; i< jsonArray.size(); i ++){
JSONObject jsonValue = jsonArray.get(i).isObject();
String lid = jsonValue.get(id)。isString()。toString()
.replace(\,).trim();
String email = jsonValue.get(email-id)。isString()。toString()
.replace(\,).trim();
grid.setWidget(i,0,new CheckBox());
grid.setHTML(i,1,lid);
grid.setHTML(i,2,email);
tabDataAll.add(grid);
$ / code>
我的问题是:这是否正确?如果是的话,我怎么能说,点击一个按钮,删除选定的行?
另外,如果我能够排序,这将是一个额外的奖励/优势列。
非常感谢。
解决方案您可以尝试以下操作。
如果您正在寻找更轻量级的解决方案,请使用此
如果您不关心资源大小,请使用这个
Basically, I want to create a table like this:
I created a grid, and added the text values, and the checkboxes. Exactly like in your email box, where you select some mails, and delete them or mark spam.
This is what I have done till now:
Grid grid = new Grid(4, 3);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonValue = jsonArray.get(i).isObject();
String lid = jsonValue.get("id").isString().toString()
.replace("\"", " ").trim();
String email = jsonValue.get("email-id").isString().toString()
.replace("\"", " ").trim();
grid.setWidget(i, 0, new CheckBox());
grid.setHTML(i, 1, lid);
grid.setHTML(i, 2, email);
tabDataAll.add(grid);
}
My question is: Is this the correct way to it? If yes, how can I say, on a click of a button, delete the selected rows?
Also, it would be an added bonus/advantage if I am able sort the columns.
Thanks a lot.
解决方案 You can try the following.
If you are looking for less weight solution use this
http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTable
If you dont care about the resource sizes use this
http://www.smartclient.com/smartgwt/showcase/#grid_interaction_checkboxselect
这篇关于复选框选择网格中的条目(GWT)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!