function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Aarti Ragoonath 9Aarti Ragoonath 9 

Remove Selected Item from a dropdown

Hi I am trying to populate a dropdown list with specific items from a custom module and once an item is selected from the dropdown I want to remove it so another person cannot select the same item. 

The idea i am try to achieve is to have an enrollment for a class and there is certain vehicle that will be assigned to someone when they are enrolling 
ajay Duggi(Heptarc)ajay Duggi(Heptarc)
Dear Aarti,

Try with below code for dropdown list.
<aura:component>
    
    <aura:attribute name="colors" type="String[]"/>
    <aura:attribute name="selectedColor1" type="String"/>
    
    <aura:handler name="init" value="{!this}" action="{!c.loadOptions}" />
    
    <lightning:select aura:id="select1-id" value="{!v.selectedColor1}" onchange="{!c.onChangeColor}" name="picklist1" label="Select a Color"  >
        <option value="">-- None --</option>
        <aura:iteration items="{!v.colors}" var="color">
            <option value="{!color.value}" text="{!color.label}"></option>
        </aura:iteration>
    </lightning:select>
    
</aura:component>
({
    loadOptions: function (component, event, helper) {
        var opts = [
            { value: "R", label: "Black" },
            { value: "G", label: "White" },
            { value: "B", label: "Green" }
         ];
         component.set("v.colors", opts);
    },
    onChangeColor: function (component, event, helper) {
        
    }
})