My requirement is:
- After giving the search criteria, show the Search Result below and focus on the search results.
- Then after selecting a row from the Search-Result, and OPEN the RECORD in a different page replacing the old one. (Have used router.navigate() method).
- From the new page, if user selects BACK hyperlink, user should see the old SEARCH page with the Results.
Now, the problem is, as mentioned above in PointNo 3, I am not able to navigate to the original 'parent page' with all the SEARCH-FORM data and the data; always the initial SEARCH-FORM is coming after navigation (returnToSearchResultsPage() method).
Your headsup and help would be very much appreciated!
-- 1. PARENT PAGE (Search Page):
showResultsOnSubmit() {
this.showSearchResults = true;
}
=============================================================
-- 2. In results-list-component:
openRecordDetails(): void {
this.router.navigate(['individual-details']);
}
=============================================================
-- 3. CHILD PAGE (In individual-details component):
// Need to return to the search-options page with the search-results intact.
returnToSearchResultsPage() {
//this.router.navigate(['search-options']);
// this._location.back();
window.history.go(-2);
}
-- 1. PARENT PAGE (Search Page):
<div>
<div>
<h1> Search</h1>
<form #searchCriteriaForm="ngForm" (ngSubmit)="showResultsOnSubmit()">
. . .
<button type="submit" [disabled]="!searchCriteriaForm.valid">Search</button>
</form>
</div>
<!-- *** Display of the Results Form @START *** -->
<div>
<results-list [showMePartially]="showSearchResults"></results-list>
</div>
<!-- **** Display of the Results Form @END *** -->
</div>
<!-- ** Display of the Results Form @START *** -->
<div>
<results-list [showMePartially]="showSearchResults"></results-list>
</div>
<!-- *** Display of the Results Form @END ** -->
</div>
=============================================================
-- 2. In results-list-component:
<div>
<button type="button" (click)="openRecordDetails()">Open Record</button>
</div>
=============================================================
-- 3. CHILD PAGE (In individual-details component):
<form>
<a href="#" style="margin-left:20px;" *ngIf="isEditModeParent" (click)="returnToSearchResultsPage()"> Return to Search Page</a>
. . . .
</form>