UI5-Toggle Button

lightUI5-Toggle Button

 

 


Toggle Button has two states like a switch to turn on and off. 

1


By default state is – off. Press the button.

2


State is ON. Close the pop up and press the switch again.

3


State is off.

4


To make the switch default state as ON. Use attribute Pressed.

5


6


Code Snippet:

// Instantiate a Toggle Button
oToggleButton = new sap.ui.commons.ToggleButton({
text: “ON”,
pressed: true,
press: function() {alert(oToggleButton.getPressed());}
}).placeAt(“content”);


 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s