复选框选择网格中的条目(GWT) [英] Checkboxes to select an entry in a grid (GWT)

查看:126
本文介绍了复选框选择网格中的条目(GWT)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我想创建一个这样的表:





我创建了一个网格,并添加了文本值和复选框。完全像在你的电子邮件箱中,你选择一些邮件,并删除它们或标记垃圾邮件。



这是我迄今为止所做的:

  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>

我的问题是:这是否正确?如果是的话,我怎么能说,点击一个按钮,删除选定的行?



另外,如果我能够排序,这将是一个额外的奖励/优势列。



非常感谢。

解决方案

您可以尝试以下操作。



如果您正在寻找更轻量级的解决方案,请使用此



http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTable



如果您不关心资源大小,请使用这个



http://www.smartclient.com/smartgwt/showcase/#grid_interaction_checkboxselect


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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆