-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Faulty list view when back navigating (#1243)
Issue table settings such as page index are not saved when table is re-mounted. This behavior inconveniences users as their settings are reset everytime they navigate to a specific issue and back. Let's lift up the table settings of each mounted table to a service which the tables pull from when mounted.
- Loading branch information
1 parent
a9d38dd
commit a1b5000
Showing
5 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export class TableSettings { | ||
public sortActiveId = ''; // The ID of the column the table is sorted by | ||
public sortDirection = ''; | ||
public pageSize = 20; | ||
public pageIndex = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { TableSettings } from '../models/table-settings.model'; | ||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
|
||
/** | ||
* Responsible for storing and retrieving the table settings for issue tables created | ||
* Map is required since there can be multiple tables within the same page | ||
*/ | ||
export class IssueTableSettingsService { | ||
private _tableSettingsMap: { [index: string]: TableSettings } = {}; | ||
|
||
public getTableSettings(tableName: string): TableSettings { | ||
return this._tableSettingsMap[tableName] || new TableSettings(); | ||
} | ||
|
||
public setTableSettings(tableName: string, tableSettings: TableSettings): void { | ||
this._tableSettingsMap[tableName] = tableSettings; | ||
} | ||
|
||
public clearTableSettings(): void { | ||
this._tableSettingsMap = {}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters