Thanks a lot Dennis. The 2nd link (without custom control) would be fine for me if it works ![]()
I have added the button as follows in the view
var oToggle_Btn = new sap.ui.commons.ToggleButton("ToggleBtn",{text:"Switch to Mode 1",
icon:"sap-icon://synchronize",
style:sap.ui.commons.ButtonStyle.Emph,
press: [oController.toggle,oController]
});
oToggle_Btn.pressedText = 'Switch to Mode2';
oToggle_Btn.speed = 500;
After that I have added the remaining code of your's in my toggle event in Controller as follows
toggle: function(oEvnt){
//Checking toggle button state and setting the curr_mode and changing the text of Toggle Button accordingly
var Tgl_Btn = sap.ui.getCore().byId("ToggleBtn");
Tgl_Btn.addEventDelegate({
onAfterRendering: function() {
var text = this.getText();
var pressedText = this.pressedText || text;
var speed = this.speed || 500;
var $this = this.$();
var front = $this.find('DIV');
var back = front.clone();
front.addClass('front');
back.find('SPAN').html(pressedText);
back.addClass('back');
$this.append(back);
$this.flip({speed: speed});
var width = this.$().width() + 'px';
$this.css('width', width);
$this.css('height', '2.5rem');
}
}, Tgl_Btn);
if (oEvnt.getParameter("pressed") == true){
//sap.ui.getCore().byId("ToggleBtn").setText("Switch to Mode2");
curr_mode = "Tabstrip";
sap.ui.getCore().byId("idTbstrip").setVisible(true);
}
else {
//sap.ui.getCore().byId("ToggleBtn").setText("Switch to Mode2");
curr_mode = "Item_Nav";
sap.ui.getCore().byId("idTbstrip").setVisible(false);
}
}
But the button is not flipping at all and even the text is not getting changed on clicking it. On console there are no errors at all. Kindly let me know where I am going wrong
Thanks a ton
Amber