Skip to main content
SHAIK MOULALI (HPE) a posé une question dans #Lightning Experience
While clickiing lightning button (Toggle), it has woring only 2 times and after not executing properly.

Component Code : 

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >

    <aura:attribute name="buttonLabel" type="String" default="Search Button"/>

    <aura:attribute name="newLabel" type="String" default="New Button"/>

    <aura:attribute name="isNewAvailable" type="Boolean" default="false"/>

    

    <aura:attribute name="CarTypes" type="String[]" default="All Types,Sport Car,Luxury Car,Van"/>

    

    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

    

    <lightning:layout horizontalAlign="center">

        <lightning:layoutItem padding="around-medium">

            <lightning:select name="selectItem " aura:id="CarType" label="All Types" variant="label-hidden" > 

                <option value="" text="All Types"/>

                <aura:iteration items="{!v.CarTypes}" var="CarType">

                    <option value="{!CarType}" text="{!CarType}"/>

                </aura:iteration>

    </lightning:select>

        

            <lightning:button label="{!v.buttonLabel}" onclick="{!c.onSearchClick}" variant="brand"/>

            <lightning:button variant='neutral' label="Toggle Button" onclick="{!c.toggleButton}" />

            <aura:if isTrue="{!v.isNewAvailable}">    

                <lightning:button variant='neutral' label="{⌗v.newLabel}"/>

                <aura:set attribute="else">

                    New button cannot be added here

                </aura:set>    

            </aura:if>  

            

        </lightning:layoutItem>

    </lightning:layout>

</aura:component>

Controller Code : 

({

    onSearchClick : function(component, event, helper) {

        helper.handlerOnSeearchClick(component, event, helper)

    },

    

    toggleButton : function(component, event, helper) {

        var CurrentValue = component.get("v.isNewAvailable");

        console.log('Method is exicuted');

        if(CurrentValue){

            console.log('New value--1'+CurrentValue);

          component.set("v.isNewAvailable","false");

            

        }    

        else{

             console.log('New value--2'+CurrentValue);

            component.set("v.isNewAvailable","true");

           

        }  

    },

    doInit : function(component, event, helper) {

        

        var CarTypes = component.set("v.CarTypes");

        component.set("v.CarTypes", ['Sport Car','Luxury Car','Van']);

        

    }

    

})

Helper Code : 

({

    handlerOnSeearchClick : function(component, event, helper) {

        alert('Search Button was clicked');

    }

})

this is my complete code, Kindly suggest how to resolve this type of Issues.

Below is the O/P of my my code.

lightning button executed only 2 times
3 réponses
  1. 30 avr. 2023, 20:19
    As an overweight person looking to get more active, I found this article https://www.bikehacks.com/bikes-for-heavy-people/ to be incredibly informative. The author provides a lot of helpful tips on how to choose the right bike, including information on weight limits and different types of frames. The article is well-written and easy to understand, and I appreciated the author's attention to detail. If you're looking for a bike that will help you get moving, this article is definitely worth a read.
0/9000