cancel
Showing results for 
Search instead for 
Did you mean: 

De-select radio button on navigation

05-19-2022 12:57 AM
1328 views 4 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

Hi ,

I have a home page.From the home page,I navigate to the StatusManagement Home Page. On the statusManagement Home page, I select a id and I navigate to the another page with the id. This page shows me the list of radio buttons with the text.

The view code for the radio buttons is shown below.

<Label labelFor="group0" text="Select the next status that you want to transition the MatrixID" /> <RadioButtonGroup columns="1" id="group0" buttons = "{statusmodel>/ODataset/results}" selectedIndex= "-1" width="500px" class="sapUiSmallMargin">

<RadioButton id= "selbutton" text="{statusmodel>TARGET_CTRL_STATUS}" customData:targetStatusCode="{statusmodel>TARGET_CTRL_STATUS_CODE}" selected = "false"/>

</RadioButtonGroup>

When I come for the first time to this screen , none of the radio buttons are selected which is what I want. I select a radio button and click on Submit. The controller takes care of the back end processing and then a success dialog message is shown and when the user clicks on OK it goes back to the status Management Home Page.

Again from the status Management Home page when I select the same id or a different id , whatever was the selected Index of the radio button on the previous navigation shows as selected.

Everytime I traverse to the screen with radio buttons I want all the radio buttons to be deselected.

Below is the routing code in the controller.

var oRouter1 = sap.ui.core.UIComponent.getRouterFor(that);

oRouter1.navTo("StatusTransitionManagement",{

ID : selectedID

},false);

What should I do to make sure that all radio buttons are deselected every time I go to that page.

Thanks in advance

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

ashwink02
Explorer
0 Likes

Hi Lalitha,

You can also try this by adding below code in routeMatched Method of the view

var oIDRadioButtonGroup = this.byId("group0");

oIDRadioButtonGroup.setSelectedIndex(-1);

former_member337435
Participant
0 Likes

Thanks Ashwin. I tried this and it worked

Answers (1)

Answers (1)

sonalika_porwal
Participant

Hi Lalitha,

You can try this scenario:

Bind a property to the selected property of RadioButton. For example:

<RadioButton id= "selbutton" 
text="{statusmodel>TARGET_CTRL_STATUS}" 
customData:targetStatusCode="{statusmodel>TARGET_CTRL_STATUS_CODE}" 
selected = "{/isRadioButtonSelected}"/>

Now, whenever you land on the radio buttons page, make the /isRadioButtonSelected property false. ( You can do that in your route-matched event handler).
You need to set your selected property as false whenever the route pattern is matched.

former_member337435
Participant
0 Likes

Thanks Sonalika !