• Taresh Khandekar
  • 0 Points
  • Member since 2016

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 2
I am using ltng:require as specified in the docs to load multiple js libraries -- in the correct order of dependency. However, the scripts only load about 50% of the time. The other 50% the jsVectorMap scripts never load and the afterScriptsLoaded function never fires. Any thoughts??
<ltng:require styles="{!join(',','/resource/slds_2_1_3','/resource/jsVectorMapCSS')}"
                  afterScriptsLoaded="{!c.setScriptLoaded}" />

I am creating a generic list component that takes in an object type, and a list of fields that it wants to display. I am looping through each of the items and building a table, but when it comes to outputting the different fields, I am at a bit of a roadblock for doing it dynamically. Here is the relevant component code: 
<aura:component description="ObjectList" controller="ObjectListController">
    <aura:attribute name="objectName" type="String" default="" />
    <aura:attribute name="objectFieldsString" type="String" default="Id,Name" />
    <aura:attribute name="objectFields" type="List" />
    <aura:attribute name="items" type="List" />

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />

            <aura:iteration items="{!v.objectFields}" var="fieldName">
                    <th scope="col"><div class="slds-truncate">{!fieldName}</div></th>
        <aura:iteration items="{!v.items}" var="item">
                <aura:iteration items="{!v.objectFields}" var="field">

In the aura:iteration in the tbody, I am trying to cycle through the different field names, and then grab those fields from the item, but it doesn't seem like lightning supports it. For example if objectFields contained an array of strings containing ["Id","Name"], I want to then grab item.Id and item.Name and display them in the table. But using {!item.field} or anything similar does not seem to work.

Could anyone provide me with the proper syntax if this is possible, or a possible workaround to get something like this to work?