Skip to Content
avatar image
Former Member

UI5: Conditional tooltip on Switch button based on state

I have a switch as one of the cells in a table. Is it possible to set two different tooltips to the SAP UI5 user interface control Switch (sap.m.Switch) based on the state of the control? For example if the switch is ON then the hover should show "Open" and if it is OFF then the hover should show "Closed".

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Aug 23, 2017 at 12:02 AM
    Add comment
    10|10000 characters needed characters exceeded

  • Aug 22, 2017 at 07:51 PM

    yes. Assign a variable as tool tip. Then based on the state of the bitton(on event) set the value of variable to on or off.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 23, 2017 at 07:20 AM

    Hi,

    Try this.

    <Switch state="false" change="callChange"></Switch>
    =======================================================
    callChange : function(oEvent){
    		if(oEvent.getParameter("state") == true)
    			oEvent.getSource().setTooltip("True Tooltip");
    		else
    			oEvent.getSource().setTooltip("False Tooltip");
    	}
    
    
    Add comment
    10|10000 characters needed characters exceeded