Skip to content

Commit f40adcd

Browse files
set initial table columns sort from saved view state on restore (#64)
1 parent 39fb5e8 commit f40adcd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

web/scripts/tableView.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,17 @@ function createTableConfig(tableColumns) {
343343
};
344344

345345
if (tableColumns && tableColumns.length > 0) {
346+
// use restored table columns config
346347
tableConfig.autoColumns = false;
347348
tableConfig.columns = tableColumns;
348349
}
350+
351+
const initialSort = viewState.tableConfig.sort;
352+
if (initialSort) {
353+
// set initial sort from restored table view state
354+
tableConfig.initialSort = initialSort;
355+
}
356+
349357
return tableConfig;
350358
}
351359

@@ -487,7 +495,6 @@ function saveTableSetting(id, type, data) {
487495
// update table config in view state
488496
tableConfig[type] = data;
489497
vscode.setState(viewState);
490-
491498
// console.log(`tableView.saveTableSetting():viewState`, viewState);
492499
}
493500

0 commit comments

Comments
 (0)