You need to sign in to do that
Don't have an account?
Andegosu
How to get selected values from custom listview
I have a custom listview that I can select Contact records from but how do I get this information in the controller to do forther actions in apex?
I have code that currently looks like this:
I have code that currently looks like this:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" controller="ListViewController"> <!-- call doInit js function on component load to fetch list view details--> <aura:handler name="init" value="this" action="{!c.doInit}"/> <!-- aura attributes --> <aura:attribute name="listViewResult" type="string[]"/> <aura:attribute name="objectInfo" type="string" default="Contact"/> <aura:attribute name="currentListViewName" type="string" /> <aura:attribute name="bShowListView" type="boolean" default="false"/> <aura:attribute name="selContacts" type="Contact[]"/> <!-- custom controls to display inside listview header--> <div class="slds-form-element"> <lightning:layout class="customCls"> <lightning:select name="select1" onchange="{!c.onPicklistChange}" label=" "> <aura:iteration items="{!v.listViewResult}" var="listView"> <option value="{!listView.developerName}">{!listView.label}</option> </aura:iteration> </lightning:select> <lightning:button label="Avidentifiera" onclick="{!c.unidentify}" variant="brand"/> </lightning:layout> </div> <!-- lightning List View : https://sforce.co/2Q4sebt--> <aura:if isTrue="{!v.bShowListView}"> <lightning:listView objectApiName="{!v.objectInfo}" listName="{!v.currentListViewName}" rows="5" showSearchBar="true" showActionBar="false" enableInlineEdit="true" showRowLevelActions="false" /> </aura:if> </aura:component>
Please go through with below code, it may be helpful to you.
Give the aura id like given below line.
<aura:attribute name="selectedValue" type="String" access="PRIVATE"/>
<lightning:select aura:id="objectName" name="select2" label="Value of Selected PickList" value="{!v.selectedValue}" required="true">
Then get the records like below code.
studentSelect : function(component,event,helper) {
var selectedObjectName = c.find('objectName').get('v.value');
console.log(selectedObjectName);
}
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
I'm not trying to get values from a select component, it's from a listview. This is component that I want to get selected values from: