UI5-Toggle Button
Toggle Button has two states like a switch to turn on and off.
By default state is – off. Press the button.
State is ON. Close the pop up and press the switch again.
State is off.
To make the switch default state as ON. Use attribute Pressed.
Code Snippet:
// Instantiate a Toggle Button
oToggleButton = new sap.ui.commons.ToggleButton({
text: “ON”,
pressed: true,
press: function() {alert(oToggleButton.getPressed());}
}).placeAt(“content”);