Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <aura:component
- <!-- PAGE HEADER -->
- <lightning:layout class="slds-page-header slds-page-header--object-home">
- <lightning:layoutItem>
- <lightning:icon iconName="standard:scan_card"
- alternativeText="primaryinfo"/>
- </lightning:layoutItem>
- <lightning:layoutItem padding="horizontal-small">
- <div class="page-section page-header">
- <h1 class="slds-text-heading--label">NIGO Email
- Communication</h1>
- <h2 class="slds-text-heading--medium">Primary Information</h2>
- </div>
- </lightning:layoutItem>
- </lightning:layout>
- <aura:attribute name="newCar" type="Childcontact__c" default="{
- 'sobjectType': 'Childcontact__c',' PrimaryInformation__c':
- '','Status__c': '','Rejected_Type__c':
- '','Deadline__c':'','Rejected_Reason__c': ''}"/>
- <aura:attribute name="newCarMap" type ="Map" ></aura:attribute>
- <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
- <div class="slds-m-around--xx-large">
- <div class="slds-float_left slds-p-bottom_small">
- <h1 class="slds-page-header__title">Add Row
- <lightning:buttonIcon iconName="utility:add" size="large" variant="bare"
- alternativeText="Add" onclick="{!c.handleAddcarClick}"/>
- </h1>
- </div>
- <div class="container-fluid">
- <table class="slds-table slds-table_bordered slds-table_cell-buffer">
- <tbody>
- <lightning:recordEditForm aura:id="CarCreateForm"
- objectApiName="Childcontact__c" >
- <aura:iteration items="{!v.newCarMap}" var="acc"
- indexVar="index">
- <tr>
- <td>
- {!index + 1}
- </td>
- <td>
- <lightning:inputField fieldName="Status__c">
- </lightning:inputField>
- </td>
- <td>
- <lightning:inputField fieldName="Rejected_Type__c">
- </lightning:inputField>
- </td>
- <td>
- <lightning:inputField fieldName="Rejected_Reason__c">
- </lightning:inputField>
- </td>
- <!--<c:LightningDependentPicklistCmp/>-->
- <td style="padding-top: 27px;padding-left: 48px;">
- <a onclick="{!c.removeRow}" data-record="{!index}">
- <lightning:icon iconName="utility:delete"
- size="small" alternativeText="Delete"/>
- <span class="slds-assistive-text">Delete</span>
- </a>
- </td>
- </tr>
- </aura:iteration>
- </lightning:recordEditForm>
- </tbody>
- </table>
- </div>
- </div>
- </aura:component>
- ({
- doInit : function(component, event, helper) {
- helper.addcar(component);
- },
- parentFieldChange : function(component, event, helper) {
- var controllerValue = component.find("parentField").get("v.value");// We can also use event.getSource().get("v.value")
- var pickListMap = component.get("v.pickListMap");
- if (controllerValue != '--- None ---') {
- //get child picklist value
- var childValues = pickListMap[controllerValue];
- var childValueList = [];
- childValueList.push('--- None ---');
- for (var i = 0; i < childValues.length; i++) {
- childValueList.push(childValues[i]);
- }
- // set the child list
- component.set("v.childList", childValueList);
- if(childValues.length > 0){
- component.set("v.disabledChildField" , false);
- }else{
- component.set("v.disabledChildField" , true);
- }
- } else {
- component.set("v.childList", ['--- None ---']);
- component.set("v.disabledChildField" , true);
- }
- },
- removeRow: function(component, event, helper) {
- //Get the account list
- var accountList = component.get("v.contactList");
- //Get the target object
- var selectedItem = event.currentTarget;
- //Get the selected item index
- var index = selectedItem.dataset.record;
- accountList.splice(index, 1);
- component.set("v.contactList", accountList);
- },
- save: function(component, event, helper) {
- if (helper.validateAccountList(component, event)) {
- helper.saveAccountList(component, event);
- }
- },
- handleAddcarClick : function(component,event,helper){
- helper.addcar(component);
- }
- })
- ({
- addcar : function(component) {
- var newCarobjmap = component.get("v.newCarMap");
- var carobj = component.get("v.newCar");
- console.log('carobj'+carobj);
- if(!$A.util.isEmpty(newCarobjmap)){
- newCarobjmap.push(carobj);
- component.set("v.newCarMap",newCarobjmap) ;
- }else {
- component.set("v.newCarMap",[].concat(carobj)) ;
- }
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement