Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.76 KB | None | 0 0
  1. <aura:component
  2.  
  3. <!-- PAGE HEADER -->
  4. <lightning:layout class="slds-page-header slds-page-header--object-home">
  5. <lightning:layoutItem>
  6. <lightning:icon iconName="standard:scan_card"
  7. alternativeText="primaryinfo"/>
  8. </lightning:layoutItem>
  9. <lightning:layoutItem padding="horizontal-small">
  10. <div class="page-section page-header">
  11. <h1 class="slds-text-heading--label">NIGO Email
  12. Communication</h1>
  13. <h2 class="slds-text-heading--medium">Primary Information</h2>
  14. </div>
  15. </lightning:layoutItem>
  16. </lightning:layout>
  17.  
  18. <aura:attribute name="newCar" type="Childcontact__c" default="{
  19. 'sobjectType': 'Childcontact__c',' PrimaryInformation__c':
  20. '','Status__c': '','Rejected_Type__c':
  21. '','Deadline__c':'','Rejected_Reason__c': ''}"/>
  22. <aura:attribute name="newCarMap" type ="Map" ></aura:attribute>
  23. <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
  24. <div class="slds-m-around--xx-large">
  25. <div class="slds-float_left slds-p-bottom_small">
  26. <h1 class="slds-page-header__title">Add Row
  27. <lightning:buttonIcon iconName="utility:add" size="large" variant="bare"
  28. alternativeText="Add" onclick="{!c.handleAddcarClick}"/>
  29. </h1>
  30. </div>
  31. <div class="container-fluid">
  32. <table class="slds-table slds-table_bordered slds-table_cell-buffer">
  33. <tbody>
  34. <lightning:recordEditForm aura:id="CarCreateForm"
  35. objectApiName="Childcontact__c" >
  36. <aura:iteration items="{!v.newCarMap}" var="acc"
  37. indexVar="index">
  38. <tr>
  39. <td>
  40. {!index + 1}
  41. </td>
  42. <td>
  43. <lightning:inputField fieldName="Status__c">
  44. </lightning:inputField>
  45. </td>
  46. <td>
  47. <lightning:inputField fieldName="Rejected_Type__c">
  48. </lightning:inputField>
  49. </td>
  50. <td>
  51. <lightning:inputField fieldName="Rejected_Reason__c">
  52. </lightning:inputField>
  53. </td>
  54. <!--<c:LightningDependentPicklistCmp/>-->
  55. <td style="padding-top: 27px;padding-left: 48px;">
  56. <a onclick="{!c.removeRow}" data-record="{!index}">
  57. <lightning:icon iconName="utility:delete"
  58. size="small" alternativeText="Delete"/>
  59. <span class="slds-assistive-text">Delete</span>
  60. </a>
  61. </td>
  62. </tr>
  63. </aura:iteration>
  64. </lightning:recordEditForm>
  65.  
  66. </tbody>
  67. </table>
  68.  
  69. </div>
  70. </div>
  71.  
  72. </aura:component>
  73.  
  74. ({
  75. doInit : function(component, event, helper) {
  76. helper.addcar(component);
  77. },
  78.  
  79. parentFieldChange : function(component, event, helper) {
  80. var controllerValue = component.find("parentField").get("v.value");// We can also use event.getSource().get("v.value")
  81. var pickListMap = component.get("v.pickListMap");
  82.  
  83. if (controllerValue != '--- None ---') {
  84. //get child picklist value
  85. var childValues = pickListMap[controllerValue];
  86. var childValueList = [];
  87. childValueList.push('--- None ---');
  88. for (var i = 0; i < childValues.length; i++) {
  89. childValueList.push(childValues[i]);
  90. }
  91. // set the child list
  92. component.set("v.childList", childValueList);
  93.  
  94. if(childValues.length > 0){
  95. component.set("v.disabledChildField" , false);
  96. }else{
  97. component.set("v.disabledChildField" , true);
  98. }
  99.  
  100. } else {
  101. component.set("v.childList", ['--- None ---']);
  102. component.set("v.disabledChildField" , true);
  103. }
  104. },
  105. removeRow: function(component, event, helper) {
  106. //Get the account list
  107. var accountList = component.get("v.contactList");
  108. //Get the target object
  109. var selectedItem = event.currentTarget;
  110. //Get the selected item index
  111. var index = selectedItem.dataset.record;
  112. accountList.splice(index, 1);
  113. component.set("v.contactList", accountList);
  114. },
  115.  
  116. save: function(component, event, helper) {
  117. if (helper.validateAccountList(component, event)) {
  118. helper.saveAccountList(component, event);
  119. }
  120. },
  121. handleAddcarClick : function(component,event,helper){
  122. helper.addcar(component);
  123. }
  124. })
  125.  
  126. ({
  127. addcar : function(component) {
  128. var newCarobjmap = component.get("v.newCarMap");
  129. var carobj = component.get("v.newCar");
  130. console.log('carobj'+carobj);
  131. if(!$A.util.isEmpty(newCarobjmap)){
  132. newCarobjmap.push(carobj);
  133. component.set("v.newCarMap",newCarobjmap) ;
  134. }else {
  135.  
  136. component.set("v.newCarMap",[].concat(carobj)) ;
  137. }
  138. }
  139. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement