Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.06 KB | None | 0 0
  1. ({
  2. init: function (cmp, event, helper) {
  3.  
  4. if(cmp.get('v.viewName') == 'Summary View'){
  5. cmp.set('v.viewName',$A.get("$Label.c.xx_Client_Summary_View"));
  6. cmp.set('v.isSummaryView', true);
  7. }else if(cmp.get('v.viewName') == 'Accounts View'){
  8. cmp.set('v.viewName',$A.get("$Label.c.xx_Client_Accounts_View"));
  9. }
  10.  
  11. helper.getAccountOptions(cmp)
  12. helper.setUpAccountDataTable(cmp);
  13. helper.getLogonContact(cmp,event,helper);
  14. helper.getInvestmentAccountContacts(cmp);
  15. helper.getData(cmp, null);
  16. },
  17.  
  18. getSelectedName: function (cmp, event) {
  19. var selectedRows = event.getParam('selectedRows');
  20. var appEvent = $A.get("e.c:xx_InvestmentAccountSelected");
  21. for (var i = 0; i < selectedRows.length; i++){
  22. cmp.set('v.investmentAccountId', selectedRows[i].Id);
  23. appEvent.setParams({"selectedInvestmentAccountId": selectedRows[i].Id});
  24. appEvent.fire();
  25. }
  26.  
  27.  
  28. },
  29.  
  30. handleHeaderAction: function (cmp, event, helper) {
  31. // Retrieves the name of the selected filter
  32. var actionName = event.getParam('action').name;
  33. // Retrieves the current column definition
  34. // based on the selected filter
  35. var colDef = event.getParam('columnDefinition');
  36. var columns = cmp.get('v.mycolumns');
  37. var activeFilter = cmp.get('v.activeFilter');
  38. if (actionName !== activeFilter) {
  39. var idx = columns.indexOf(colDef);
  40. // Update the column definition with the updated actions data
  41. var actions = columns[idx].actions;
  42. actions.forEach(function (action) {
  43. action.checked = action.name === actionName;
  44. });
  45. cmp.set('v.activeFilter', actionName);
  46. helper.updateMarketValues(cmp);
  47. cmp.set('v.mycolumns', columns);
  48. }
  49. },
  50. // Client-side controller called by the onsort event handler
  51. updateColumnSorting: function (cmp, event, helper) {
  52. var fieldName = event.getParam('fieldName');
  53. var sortDirection = cmp.get("v.sortedDirection");
  54. // assign the latest attribute with the sorted column fieldName and sorted direction
  55. cmp.set("v.sortedBy", fieldName);
  56. if (sortDirection === 'asc') {
  57. cmp.set("v.sortedDirection", "desc");
  58. } else {
  59. cmp.set("v.sortedDirection", "asc");
  60. }
  61. helper.sortData(cmp, fieldName, sortDirection);
  62. },
  63.  
  64. handleContactOptionSelected: function (cmp, event) {
  65.  
  66. // handle investor selected
  67. var selectedContactId = event.getParam("value");
  68. cmp.set('v.selectedContactId', selectedContactId);
  69. var contactsMap = cmp.get('v.targetContacts');
  70. cmp.set('v.selectedContactName', contactsMap.get(selectedContactId));
  71. },
  72.  
  73. handleGo: function (cmp, event, helper) {
  74. // Get the string of the "value" attribute on the selected option
  75.  
  76. var selectedRows = [];
  77. cmp.set('v.selectedRows', selectedRows);
  78. var appEvent = $A.get("e.c:xx_InvestmentAccountSelected");
  79. appEvent.setParams({"selectedInvestmentAccountId": null});
  80. appEvent.fire();
  81.  
  82. var selectedContactId = cmp.get('v.selectedContactId');
  83. helper.getData(cmp, selectedContactId);
  84. /*
  85. * Encountered issue with following scenario:
  86. * logon contact has 3 investment accounts, select investment accounts to display account summary
  87. * switch to second contact that has one account, select investment account to display account summary
  88. * switch back to the logon contact to display 3 investment accounts. Not able to select any of the radio button for each of the 3 rows.
  89. * if reselect logon contact again, the radio button open up for selection again.
  90. * This is a temporary fix below to set the data in the table again to open up the radio button in the above situation
  91. */
  92. // helper.getData(cmp, selectedContactId);
  93.  
  94.  
  95.  
  96. helper.contactChangedEvent(cmp);
  97. },
  98.  
  99. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement