Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,16 @@ export class DbTableViewComponent implements OnInit, OnChanges {
);

if (!loading && this.tableData.defaultSort !== undefined) {
// Update defaultSort reference whenever data loads
this.defaultSort = this.tableData.defaultSort;

console.log('DbTableViewComponent tableData loaded:', this.tableData);
console.log('DbTableViewComponent tableData.defaultSort loaded:', this.tableData.defaultSort);

// Only initialize sort on first load (or after table switch when sortInitialized was reset)
// Only initialize sort and defaultSort on first load (or after table switch when sortInitialized was reset)
if (!this.sortInitialized) {
this.sortInitialized = true;

// Only sync defaultSort from server on initial load, not on subsequent sort/pagination changes
this.defaultSort = this.tableData.defaultSort;

// Initialize sort based on priority: URL params > default sort
if (urlSortActive && urlSortDirection) {
// Use sort from URL
Expand Down Expand Up @@ -266,6 +266,9 @@ export class DbTableViewComponent implements OnInit, OnChanges {
this.sort.active = '';
this.sort.direction = '' as any;

// Reset defaultSort so the previous table's default doesn't show on the new table
this.defaultSort = null;

// Reset the sortInitialized flag so the sort gets re-initialized with new table's default sort
this.sortInitialized = false;
}
Expand Down
Loading