0

In Component, I want to show Accordion's label as Time field. Also, I have the same Time field inside.. Both are not showing correctly as in Record page.

I have also tried lightning:formattedTime inside, but result are same.

lightning:formattedTime

enter image description here

Below is my component piece,

<lightning:accordion aura:id="accordion">
    <aura:iteration items="{!v.Agens}" var="Agenda">
        <lightning:recordViewForm recordId="{!Agenda.Id}" objectApiName="Agenda__c">
            <lightning:accordionSection name="A" label="{!Agenda.Time__c}">
                <div class="slds-box slds-form_horizontal slds-form slds-grid slds-wrap">
                    <lightning:outputField fieldName="Time__c" />
                    <lightning:outputField fieldName="Name" />
                </div>
            </lightning:accordionSection>
        </lightning:recordViewForm>
    </aura:iteration>
</lightning:accordion>
1

Not sure why its not working, even in my Dev org Time is not displayed, but I found a workaround for it, check if it works for you.

Event using lightning:outputField with lightning:recordEditForm does not work.

Basically I used lightning:recordEditForm and lightning:inputField with attribute disabled="true".

So you must implement JS validation for it to be readonly.

<lightning:recordEditForm recordId="0012800000IOph3" objectApiName="Account">
        <lightning:messages />
        <lightning:outputField fieldName="Name" />
        <lightning:inputField fieldName="Time__c" disabled="true"/>
        <lightning:button class="slds-m-top_small" variant="brand" type="submit" name="update" label="Update" />
    </lightning:recordEditForm>

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.