Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. <aura:attribute name = "AccountList" type="List" />
  2. <aura:attribute name = "AccountList2" type="Account[]" />
  3. <aura:attribute name = "AccountList3" type="Account[]" />
  4. <aura:handler name="init" value="{!this}" action="{!c.doinit}" />
  5.  
  6.  
  7. <table>
  8. <tr>
  9. <th class="head">Name</th>
  10. <th class="head">Case</th>
  11. <th class="head">IB</th>
  12. </tr>
  13. <aura:iteration items="{!v.AccountList}" var="acct"><br/>
  14. <tr>
  15. <td class="cell">
  16. <ui:outputText value="{!acct.Name}" />
  17. </td>
  18. <td class="cell">
  19. <ui:inputCheckbox value="{!acct.CaseSelected}" />
  20. </td>
  21. <td class="cell">
  22. <ui:inputCheckbox value="{!acct.IBSelected}" />
  23. </td>
  24. </tr>
  25. </aura:iteration>
  26. </table>
  27.  
  28. var accountId = component.get('v.recordId');
  29. var action = component.get('c.getAccountList');
  30.  
  31. action.setParams({
  32. accountId : accountId
  33.  
  34. });
  35.  
  36.  
  37. action.setCallback(this, function(response){
  38. var responseValue = response.getReturnValue();
  39. console.log('responseValue',responseValue);
  40. component.set("v.AccountList",responseValue)
  41. },'SUCCESS' );
  42.  
  43. }
  44.  
  45. if(acc.ParentId == null){
  46. List<Account> AccountList2 = new List<Account>([Select Id,Name from Account Where ParentId=:acc.id]);
  47. List<Account> AccountList3 = new List<Account>([Select Id, Name from Account Where id=: accountId]);
  48. FinalAccount.addAll(AccountList3);
  49. FinalAccount.addAll(AccountList2);
  50. System.Debug(FinalAccount);
  51. return FinalAccount ;
  52. }
  53.  
  54. else{
  55. List<Account> AccountList3 = new List<Account>([Select id, name from account where id=:acc.ParentId]);
  56. List<Account> AccountList2 = new List<Account>([Select Id,Name from Account Where ParentId=:acc.id]);
  57. List<Account> lstAct = [Select Id,Name from Account Where Parentid=:acc.ParentId];
  58. FinalAccount.addAll(AccountList3);
  59. FinalAccount.addAll(lstAct);
  60. FinalAccount.addAll(AccountList2);
  61. System.Debug(FinalAccount);
  62. return FinalAccount ;
  63. }
  64.  
  65. @AuraEnabled
  66. public String Name {get;set;}
  67.  
  68. @AuraEnabled
  69. public boolean CaseSelected {get;set;}
  70.  
  71. @AuraEnabled
  72. public boolean IBSelected {get;set;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement