On Feb 21, 6:21 pm, tong123123 <[email protected]> wrote:
> I don't know how to use a CheckboxCell coupled with a SingleSelectionModel.
> CheckboxCell selected = new CheckboxCell();
> Column<Log, Boolean> chkColumn = new Column<Log, Boolean>(selected){
> public Boolean getValue(Log log){
> return log.getSelected();
> }
>
> };
>
> table.addColumn(chkColumn, "selected");
> final SingleSelectionModel<Log> singleSelectionModel = new
> SingleSelectionModel<Log>();
> table.setSelectionModel(singleSelectionModel);
>
> but when I run the program, I found that if I click on a row, the row get
> focus first, then I need a second mouse click to cause to checkbox checked,
> then if I click the checkbox in another row, that row get selected but the
> checkbox of that row is not checked and I need to click the checkbox once
> again to selected it.
>
> why will this happen?
I try to add a SelectionChangeHandler to the table as follow:
singleSelectionModel.addSelectionChangeHandler(new
SelectionChangeEvent.Handler(){
public void onSelectionChange(SelectionChangeEvent event){
Log selectedLog =
singleSelectionModel.getSelectedObject();
selectedLog.setSelected(true);
}});
table.setSelectionModel(singleSelectionModel);
but after adding this code, user can select multi checkbox now!!
So how to make a table with a column checkbox and then only allow user
to select one checkbox only?
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.