Checkboxes to select an entry in a grid (GWT)
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 = json开发者_如何学编程Array.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
精彩评论