Skip to main content

New to aura development looking to get some insight on how to keep the data set from reverting back to original data when on click opens in new window. After selecting to view the data-table as some other user other than the logged in user , it should retain the data table set when navigating to a new window

 

<aura:component controller="MyClass" implements="flexipage:availableForAllPageTypes,force:appHostable" access="global" >

    <aura:attribute name="viewAsUsers" type="Object" default="[]"/>

    <aura:attribute name="viewAsUsersIds" type="String" default=""/>

    <aura:attribute name="viewAsUsersBoolean" type="Boolean" default="false"/>

<aura:attribute name="isViewAs" type="boolean" default="false"/>

<force:recordData aura:id="recordLoader" recordId="{!$SObjectType.CurrentUser.Id}"  fields="Related_Contact_Id__c" targetFields="{!v.currentUser}"/>    <!--<aura:attribute name="auraResultSelect" type="Integer" default="100"/>-->

    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

    

    <article class="slds-card">

  

        <div class="slds-card__header slds-grid">

            <header class="slds-media slds-media_center slds-has-flexi-truncate">

                <div class="slds-media__figure">

                    <span class="slds-icon_container slds-icon-standard-account" title="account">

                        <lightning:icon iconName="standard:account" size="medium"/>

                        <span class="slds-assistive-text">account</span>

                    </span>

                </div>

                <div class="slds-media__body">

                    <h2 class="slds-card__header-title">

                        <div class="myProspectsHeader">

                            <div class="slds-popover slds-popover_tooltip slds-nubbin_bottom-left tooltipDisplay firstTooltipDisplay" role="tooltip" id="help">

                                <div class="slds-popover__body popoverText">Click to open in full screen mode.</div>

                            </div>

                            <a href="/lightning/n/My_Prospects" target="_blank" class="slds-card__header-link slds-truncate" title="Accounts">

                                <span style="font-size:18px;">My Prospects</span>

                                <span style="position:relative; top:-3px;">

                                    <lightning:helptext

                                    content=""/>

                                </span>

                            </a>

                        </div>

                    </h2>

                    <aura:if isTrue="{!v.viewAsUsersBoolean}">

                        <i>Viewing as other individual(s).  Click 'View As' to change.</i>

                    </aura:if>

                </div>

Here in the href when the new window opens if the aura: if isTrue="{!v.viewAsUsersBoolean}" then instead of resetting to original datatable should keep the selected values for View As User 

 <lightning:button aura:id="viewAsButton" class="slds-button slds-button_neutral" onclick="{!c.openModal}">View Other's Prospects</lightning:button>

 

.js file 

  handleSubmit(event) {

        this.checkForErrors();

        const selected = this.template.querySelector('c-ent-_-lookup-component').getSelection();

        if (this.errors.length === 0) {

            this.notifyUser('Success', 'Successfully updated "View As" filter.', 'success');

        }

 

        let selectedEvent = new CustomEvent('viewas', 

                                 {detail : { contacts: selected, ids:selected.map((sel) => sel.id)}}

                                );

        this.dispatchEvent(selectedEvent);    

    }

0/9000