mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 06:08:11 +00:00
Persist table sort options (#2329)
This commit is contained in:
committed by
Deep Tailor
parent
9cb7e09aef
commit
78dccf1e0a
@ -59,6 +59,7 @@ define([
|
|||||||
this.filterObserver = undefined;
|
this.filterObserver = undefined;
|
||||||
|
|
||||||
this.createTableRowCollections();
|
this.createTableRowCollections();
|
||||||
|
|
||||||
openmct.time.on('bounds', this.refreshData);
|
openmct.time.on('bounds', this.refreshData);
|
||||||
openmct.time.on('timeSystem', this.refreshData);
|
openmct.time.on('timeSystem', this.refreshData);
|
||||||
}
|
}
|
||||||
@ -74,13 +75,17 @@ define([
|
|||||||
|
|
||||||
createTableRowCollections() {
|
createTableRowCollections() {
|
||||||
this.boundedRows = new BoundedTableRowCollection(this.openmct);
|
this.boundedRows = new BoundedTableRowCollection(this.openmct);
|
||||||
|
|
||||||
//By default, sort by current time system, ascending.
|
|
||||||
this.filteredRows = new FilteredTableRowCollection(this.boundedRows);
|
this.filteredRows = new FilteredTableRowCollection(this.boundedRows);
|
||||||
this.filteredRows.sortBy({
|
|
||||||
|
//Fetch any persisted default sort
|
||||||
|
let sortOptions = this.configuration.getConfiguration().sortOptions;
|
||||||
|
|
||||||
|
//If no persisted sort order, default to sorting by time system, ascending.
|
||||||
|
sortOptions = sortOptions || {
|
||||||
key: this.openmct.time.timeSystem().key,
|
key: this.openmct.time.timeSystem().key,
|
||||||
direction: 'asc'
|
direction: 'asc'
|
||||||
});
|
};
|
||||||
|
this.filteredRows.sortBy(sortOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadComposition() {
|
loadComposition() {
|
||||||
@ -210,6 +215,16 @@ define([
|
|||||||
delete this.subscriptions[keyString];
|
delete this.subscriptions[keyString];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sortBy(sortOptions) {
|
||||||
|
this.filteredRows.sortBy(sortOptions);
|
||||||
|
|
||||||
|
if (this.openmct.editor.isEditing()) {
|
||||||
|
let configuration = this.configuration.getConfiguration();
|
||||||
|
configuration.sortOptions = sortOptions;
|
||||||
|
this.configuration.updateConfiguration(configuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
this.boundedRows.destroy();
|
this.boundedRows.destroy();
|
||||||
this.filteredRows.destroy();
|
this.filteredRows.destroy();
|
||||||
|
@ -409,7 +409,7 @@ export default {
|
|||||||
direction: 'asc'
|
direction: 'asc'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.table.filteredRows.sortBy(this.sortOptions);
|
this.table.sortBy(this.sortOptions);
|
||||||
},
|
},
|
||||||
scroll() {
|
scroll() {
|
||||||
if (!this.processingScroll) {
|
if (!this.processingScroll) {
|
||||||
|
Reference in New Issue
Block a user