1

I have a custom listview that you can select records from but I have no idea of how to obtain these records to handle them in the controller?

My code 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>

0

You can put below lines in js controller -

onPicklistChange: function(component, event, helper) {

    component.set("v.selContacts",event.getSource().get("v.value"));

}

  • I do not want to get the value from the picklist. I want to get the value from the selected records in the listView. – Andegosu Apr 2 at 9:08
  • @Andegosu did you get the solution for the same? – gs650x Aug 12 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.