Checkboxes to select an entry in a grid (GWT)

不羁的心 提交于 2019-12-25 04:54:08

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/3976379/checkboxes-to-select-an-entry-in-a-grid-gwt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!