Skip to main content
Hi 

I am getting the data from response.Now i have to filter the data based on the picklist selection.

Note: i am not using any object.

Thanks
2 answers
  1. Nov 28, 2019, 2:18 PM
    Hi Venkat,  

    You can filter the list and show the filtered list in the UI like this:

    <aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

        

        <aura:attribute name="DataList" type="List" />

        <aura:attribute name="FilteredDataList" type="List" />

        

        <lightning:select name="Picklist" label="Status" onchange="{!c.onChange}">

        </lightning:select>

    </aura:component>

    js Controller:

    ({

        onChange: function (cmp, event, helper) {

            var selPickListValue = event.getSource().get("v.value");

            var filteredList=[];

            var dataList = component.get("v.DataList");

            

            for(var i=0;i<dataList.length;i++){

                if(dataList[i] == selPickListValue)

                    filteredList.push(dataList[i]);

            }

            if(filteredList.length>0)

                component.set("v.FilteredDataList",filteredList);

            }  

    })

    I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

    Thanks and Regards,

    Deepali Kulshrestha

    www.kdeepali.com
0/9000