function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
.THIS .slds-truncate { max-width: 100%; background: brown !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
public class AccountsWithContact { @AuraEnabled public static List<Account> getBooksByAllCategories(){ List<Account> accCons = [Select Name,(Select FirstName, LastName from Contacts) from Account]; return accCons; } }
<aura:component controller="AccountsWithContact" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" > <aura:attribute name="accList" type="Account[]" /> <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> <lightning:accordion aura:id="accordion" allowMultipleSectionsOpen="true"> <aura:iteration items="{!v.accList}" var="acc"> <lightning:accordionSection name="A" label="{!acc.Name}" > <aura:set attribute="body"> <table class="slds-table slds-table--bordered slds-table--cell-buffer slds-table--striped slds-max-medium-table--stacked-horizontal" role="grid"> <thead> <tr> <th class="slds-is-sortable slds-cell-wrap" scope="col"> Name </th> </tr> </thead> <tbody> <aura:iteration items="{!acc.Contacts}" var="con"> <tr class="slds-hint-parent"> <td role="gridcell" class="slds-cell-wrap"> <div class="">{!con.LastName}</div> </td> <td role="gridcell" class="slds-cell-wrap"> <div class="" data-label="Role">{!con.FirstName}</div> </td> </tr> </aura:iteration> </tbody> </table> </aura:set> </lightning:accordionSection> </aura:iteration> </lightning:accordion> </aura:component>
({ doInit : function(component, event, helper) { var action = component.get("c.getBooksByAllCategories"); action.setCallback(this, function(a) { component.set("v.accList", a.getReturnValue()); }); $A.enqueueAction(action); } })
''
This code is working for me
Class Component Component controller Component styles