Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ({
- init: function (cmp, event, helper) {
- if(cmp.get('v.viewName') == 'Summary View'){
- cmp.set('v.viewName',$A.get("$Label.c.xx_Client_Summary_View"));
- cmp.set('v.isSummaryView', true);
- }else if(cmp.get('v.viewName') == 'Accounts View'){
- cmp.set('v.viewName',$A.get("$Label.c.xx_Client_Accounts_View"));
- }
- helper.getAccountOptions(cmp)
- helper.setUpAccountDataTable(cmp);
- helper.getLogonContact(cmp,event,helper);
- helper.getInvestmentAccountContacts(cmp);
- helper.getData(cmp, null);
- },
- getSelectedName: function (cmp, event) {
- var selectedRows = event.getParam('selectedRows');
- var appEvent = $A.get("e.c:xx_InvestmentAccountSelected");
- for (var i = 0; i < selectedRows.length; i++){
- cmp.set('v.investmentAccountId', selectedRows[i].Id);
- appEvent.setParams({"selectedInvestmentAccountId": selectedRows[i].Id});
- appEvent.fire();
- }
- },
- handleHeaderAction: function (cmp, event, helper) {
- // Retrieves the name of the selected filter
- var actionName = event.getParam('action').name;
- // Retrieves the current column definition
- // based on the selected filter
- var colDef = event.getParam('columnDefinition');
- var columns = cmp.get('v.mycolumns');
- var activeFilter = cmp.get('v.activeFilter');
- if (actionName !== activeFilter) {
- var idx = columns.indexOf(colDef);
- // Update the column definition with the updated actions data
- var actions = columns[idx].actions;
- actions.forEach(function (action) {
- action.checked = action.name === actionName;
- });
- cmp.set('v.activeFilter', actionName);
- helper.updateMarketValues(cmp);
- cmp.set('v.mycolumns', columns);
- }
- },
- // Client-side controller called by the onsort event handler
- updateColumnSorting: function (cmp, event, helper) {
- var fieldName = event.getParam('fieldName');
- var sortDirection = cmp.get("v.sortedDirection");
- // assign the latest attribute with the sorted column fieldName and sorted direction
- cmp.set("v.sortedBy", fieldName);
- if (sortDirection === 'asc') {
- cmp.set("v.sortedDirection", "desc");
- } else {
- cmp.set("v.sortedDirection", "asc");
- }
- helper.sortData(cmp, fieldName, sortDirection);
- },
- handleContactOptionSelected: function (cmp, event) {
- // handle investor selected
- var selectedContactId = event.getParam("value");
- cmp.set('v.selectedContactId', selectedContactId);
- var contactsMap = cmp.get('v.targetContacts');
- cmp.set('v.selectedContactName', contactsMap.get(selectedContactId));
- },
- handleGo: function (cmp, event, helper) {
- // Get the string of the "value" attribute on the selected option
- var selectedRows = [];
- cmp.set('v.selectedRows', selectedRows);
- var appEvent = $A.get("e.c:xx_InvestmentAccountSelected");
- appEvent.setParams({"selectedInvestmentAccountId": null});
- appEvent.fire();
- var selectedContactId = cmp.get('v.selectedContactId');
- helper.getData(cmp, selectedContactId);
- /*
- * Encountered issue with following scenario:
- * logon contact has 3 investment accounts, select investment accounts to display account summary
- * switch to second contact that has one account, select investment account to display account summary
- * 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.
- * if reselect logon contact again, the radio button open up for selection again.
- * This is a temporary fix below to set the data in the table again to open up the radio button in the above situation
- */
- // helper.getData(cmp, selectedContactId);
- helper.contactChangedEvent(cmp);
- },
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement