> I create a radioCell class as follow:
> public class RadioCell extends CheckboxCell {
>
> /**
> * An html string representation of a checked input box.
> */
> private static final SafeHtml INPUT_SELECTED =
> SafeHtmlUtils.fromSafeConstant("<input type=\"radio\" name=\"selected
> \" tabindex=\"-1\" checked/>");
> private static final SafeHtml INPUT_UNCHECKED =
> SafeHtmlUtils.fromSafeConstant("<input type=\"radio\" name=\"selected
> \" tabindex=\"-1\"/>");
> @Override
> public void render(Context context, Boolean value,
> SafeHtmlBuilder sb) {
> // Get the view data.
> Object key = context.getKey();
> Boolean viewData = getViewData(key);
>
> if (value != null && value) {
> sb.append(INPUT_SELECTED);
> } else{
> sb.append(INPUT_UNCHECKED);
> }
> }
>
> }
>
> everything is ok, when I select a radiobutton, it will be selected.
> now I want to add a button and when press this button, it will give me
> the selected record, I plan to use
> SingleSelectionModel.getSelectedRecord(), and the following is the
> selectionmodel:
> final SingleSelectionModel<Log> singleSelectionModel = new
> SingleSelectionModel<Log>(keyProvider);
> singleSelectionModel.addSelectionChangeHandler(new
> SelectionChangeEvent.Handler(){
> @Override
> public void onSelectionChange(SelectionChangeEvent event) {
> // TODO Auto-generated method stub
>
> singleSelectionModel.setSelected(singleSelectionModel.getSelectedObject(),
> true);
> table.redraw();
> }});
>
> table.setSelectionModel(singleSelectionModel);
>
> but now a very strange thing occur, when I select a radiobutton in a
> row of the table, the radio button will not selected, I need press the
> radio button once more to get it selected, before adding the
> singleselectionmodel,
> no this problem occur!!
is there a way to locate the previous selected object in
onSelectionChange event so I can set its value to false?
I found that although I set the selected object to true, but the
previous selected object is also true, and seems there is no method in
onSelectionChange event to get the previous selected object, any
method?
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment