Question

Let say we have this code:

<window>    
   <radio selected="@bind(vm.value)" /> 
</window>

When we click this radio button it will get selected ...but clicking it again do not unselect it..

Is there a better approach other then binding the onClick and toggling it in java ?

Was it helpful?

Solution

Try it :

you create a method in java class just like showVisibleRadio and check condition .

   <window>    
       <radio selected="@bind(vm.value)"   onCheck="@command('showVisibleRadio')"/> 
    </window>  

//java code

  @Command
     public void  showVisibleRadio(){

       if (value.isChecked()){
       value.setChecked(false);
       }
       else{
       value.setChecked(true);
      }
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top