+ Start a Discussion
VSK98VSK98 

Custom logout functionality not working lightning

Hi All,

I have to build custom logout functionality when the user clicks on the toggle button. 
I have tried with lightning:buttonmenu but when the user clicks on toggle button the username disappears.

Snippet below:
 
<p class="slds-page-header__title slds-m-right_small slds-align-middle slds-truncate"  title="test" style="color:white">TEST
            <span ><div class="slds-float_right"> {!v.userInfo.Name}
      <lightning:buttonMenu aura:id="menu" onselect="{! c.handleSelect }" alternativeText="Show menu">
        <lightning:menuItem value="Logout" label="Logout" />
      </lightning:buttonMenu></div></span></p>
Controller:
handleSelect: function (cmp, event, helper) {
        
       // var selectedMenuItemValue = event.getParam("value");
         window.location.href= 'https://test.salesforce.com'; 
      
    }
Actual Page: Actual Page

Username Disappear:
disappear

Regards,
VSK98
Praveen Rai sfdcPraveen Rai sfdc

Hi VSK98,

Please add this snippet , I hope It will work.

<div class="slds-m-around_xx-small">
    <div class="slds-float_left slds-page-header__title slds-m-right_small slds-align-middle slds-truncate"  title="test" style="color:Red">TEST
           </div> <span ><div class="slds-float_right"> {!v.userInfo.Name}
      <lightning:buttonMenu aura:id="menu" onselect="{! c.handleSelect }" alternativeText="Show menu">
        <lightning:menuItem value="Logout" label="Logout" />
      </lightning:buttonMenu></div></span>
    </div>


Regards,

Praveen Rai

VSK98VSK98
Hi Praveen Rai,

I have used your snipped code, unfortunately, there is an issue in alignment. Later I have done some changes now its working fine.
Thanks for your response :)

My Snippet:
<div class="slds-media__body">    
   <div class="slds-page-header__name">   
    <div class="slds-float_left slds-page-header__title slds-m-right_small slds-align-middle slds-truncate"  title="Test" style="color:Red">Test
           </div> <span ><div class="slds-float_right" style="color:White"> {!v.userInfo.Name}
      <lightning:buttonMenu aura:id="menu" onselect="{! c.handleSelect }" alternativeText="Show menu">
        <lightning:menuItem value="Logout" label="Logout" />
      </lightning:buttonMenu></div></span>
    
    </div>
  </div>

Regards,
VSK98​​​​​​​