0
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId"
            access="global"
            controller="BOM_Item_Component_Controller" >
<aura:attribute name="isOpen" type="boolean" default="false"/>
<aura:attribute name="errMsg" type="String" default=""/>
<aura:attribute name="class" type="String" default="slds-col slds-size_1-of-1" />
<aura:attribute name="classOfTextChildBOM" type="String" default="slds-hide" />
<aura:attribute name="classOfInputChildBOM" type="String" default="slds-hide" />
<aura:attribute name="classOfCancelChildBOM" type="String" default="slds-hide" />
<aura:attribute name="classOfTextProduct" type="String" default="slds-hide" />
<aura:attribute name="classOfInputProduct" type="String" default="slds-hide" />
<aura:attribute name="classOfCancelProduct" type="String" default="slds-hide" />
<aura:attribute name="classOfTextProductF" type="String" default="slds-hide" />
<aura:attribute name="classOfInputProductF" type="String" default="slds-hide" />
<aura:attribute name="classOfCancelProductF" type="String" default="slds-hide" />
<aura:attribute name="classOfChildBOM" type="String" default="slds-col slds-size_1-of-1" />
<aura:attribute name="classOfProduct" type="String" default="slds-col slds-size_1-of-1" />
<aura:attribute name="classOfProductFamily" type="String" default="slds-col slds-size_1-of-1" />
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="modelHeading" type="String" default="New Item"/>
<aura:attribute name="buttonLabel" type="String" default="Save"/>
<aura:attribute name="BOMId" type="String" />
<aura:attribute name="data" type="Object"/>
<aura:attribute name="columns" type="List"/>
<aura:attribute name = "tableHeight" type="String"/>
<aura:attribute name="showRowNumberColumn" type="Boolean" />
<!-- This attribute will hold the update records from data table-->
<aura:attribute name="updatedRecord" type="Object[]" />
<aura:handler event="force:refreshView" action="{!c.isRefreshed}" />
<aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
<aura:if isTrue="{!v.isOpen}">
<lightning:recordEditForm aura:id="form" objectApiName="HS_Sales__Bill_Of_Materials_Item__c" onsuccess="{!c.handleSuccess}" onsubmit="{!c.handleSubmit}" recordId="{!v.BOMId}">
    <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
        <div class="slds-modal__container">
                <!-- ###### MODAL BOX HEADER Start ######-->
                <header class="slds-modal__header">
                    <lightning:buttonIcon iconName="utility:close"
                                          onclick="{!c.cancel }"
                                          alternativeText="close"
                                          variant="bare-inverse"
                                          class="slds-modal__close"/>
                    <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">{!v.modelHeading}</h2>
                </header>
            <aura:if isTrue="{!v.errMsg != ''}">
                    <div class="slds-notify slds-notify_toast slds-theme_error">{!v.errMsg}</div>
                </aura:if>
            <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                    <div class="{!v.class}"><lightning:inputField fieldName="Name" aura:id="Name" /></div>
                    <div class="{!v.classOfTextChildBOM}" style="padding-top:10px"><a href ="#" onclick ="{!c.CreateChildBOM}"><ui:outputText value="Create New Child BOM"/></a></div>
                    <div class="{!v.classOfCancelChildBOM}" style="padding-top:10px"><a href ="#" onclick ="{!c.CancelCreateChildBOM}"><ui:outputText value="Cancel"/></a></div>
                    <div class="{!v.classOfInputChildBOM}"><lightning:input label="Child BOM" aura:id="inputChildBOM" /></div>
                    <div class="{!v.classOfChildBOM}"><lightning:inputField aura:id="childBOM" fieldName="HS_Sales__Child_BOM__c" class="ggg"/></div>
                    <div class="{!v.classOfTextProduct}" style="padding-top:10px"><a href ="#" onclick ="{!c.CreateProduct}"><ui:outputText value="Create New Product"/></a></div>
                    <div class="{!v.classOfCancelProduct}" style="padding-top:10px"><a href ="#" onclick ="{!c.CancelCreateProduct}"><ui:outputText value="Cancel"/></a></div>
                    <div class="{!v.classOfInputProduct}"><lightning:input label="Product" aura:id="inputProduct" /></div>
                    <div class="{!v.classOfProduct}"><lightning:inputField aura:id="product" fieldName="HS_Sales__Product__c" /></div>
                    <div class="{!v.classOfTextProductF}" style="padding-top:10px"><a href ="#" onclick ="{!c.CreateProductFamily}"><ui:outputText value="Create New Product Family"/></a></div>
                    <div class="{!v.classOfCancelProductF}" style="padding-top:10px"><a href ="#" onclick ="{!c.CancelCreateProductFamily}"><ui:outputText value="Cancel"/></a></div>
                    <div class="{!v.classOfInputProductF}"><lightning:input label="Product Family" aura:id="inputProductFamily" /></div>
                    <div class="{!v.classOfProductFamily}"><lightning:inputField aura:id="productFamily" fieldName="HS_Sales__Product_Family__c" /></div>
                    <div class="{!v.class}" style="padding-top:10px;padding-bottom:10px"><lightning:inputField fieldName="HS_Sales__Required__c" /></div>
                    <div class="{!v.class}"><lightning:inputField fieldName="HS_Sales__Sort_Order__c" /></div>
                    <div class="slds-hide"><lightning:inputField aura:id="BOM" fieldName="HS_Sales__Bill_Of_Materials__c" /></div>

            </div>
            <footer class="slds-modal__footer">
                <lightning:button class="slds-m-top_small" variant="brand" type="submit" name="save" label="{!v.buttonLabel}" />
                <lightning:button class="slds-m-top_small" variant="neutral" label="Cancel" onclick="{!c.cancel}"/>
            </footer>
        </div>
    </section>
    <div class="slds-backdrop slds-backdrop_open"></div>
</lightning:recordEditForm>
</aura:if>


<!-- You must define keyField as 'Id' to save the record back in Salesforce

 <div class="slds-p-around_medium">
    <h1 class="slds-text-heading_large">Bill Of Material Items</h1>
</div>-->
<div align = "center" style="padding-bottom:10px" >
    <lightning:button variant="brand" label="New Item" onclick="{!c.openModel}"/>
</div>
<div style="height: 700px">
    <lightning:datatable
                         aura:id="BOMItemDataTable"
                         columns="{! v.columns }"
                         data="{! v.data }"
                         keyField="Id"
                         onsave ="{!c.onSave}"
                         hideCheckboxColumn="true"
                         onrowaction="{! c.handleRowAction }"
                         maxColumnWidth="350" 
                         minColumnWidth="10"
                         />

</div>

  • Did you check in console you might getting some exception? – Tushar Sharma Jan 10 at 8:46
  • yeah i checked no error in console @TusharSharma – Ajay Choudhary Jan 10 at 10:54

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.