Skip to content

Commit 821dd94

Browse files
initialize Save dropdown in table views via new addSaveOptions() setup call (#88)
to populate save data options based on table view implementation and capabilities
1 parent ec57285 commit 821dd94

File tree

5 files changed

+30
-5
lines changed

5 files changed

+30
-5
lines changed

src/views/tableView.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -689,10 +689,6 @@ export class TableView {
689689
<select id="save-file-type-selector" title="Save Data">
690690
<option value="">📥&nbsp;Save</option>
691691
<option value="csv">,,, csv</option>
692-
<option value="ssv">;;; csv</option>
693-
<option value="tsv">⇥ tsv</option>
694-
<option value="json">{} &nbsp;json</option>
695-
<option value="html">&lt;/&gt; &nbsp;html</option>
696692
</select>
697693
<vscode-button id="view-table-config-button"
698694
appearance="icon" aria-label="View Table Config">

web/scripts/perspective.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@ document.addEventListener('DOMContentLoaded', async function () {
3333
viewer.addEventListener('perspective-config-update', onConfigUpdate);
3434
});
3535

36+
/**
37+
* Adds supported data format save options
38+
* to the tabular data view toolbar Save dropdown.
39+
*
40+
* @param {*} saveFileTypeSelector Save dropdown UI component.
41+
*/
42+
function addSaveOptions(saveFileTypeSelector) {
43+
// add save JSON and arrow data options
44+
saveFileTypeSelector.innerHTML += `
45+
<option value="json">{} &nbsp;json</option>
46+
<option value="arrow">⋙ arrow</option>`;
47+
}
48+
3649
/**
3750
* Perspective view config update handler.
3851
*/

web/scripts/tableView.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ function initializeView() {
7474
// save file selector
7575
saveFileTypeSelector = document.getElementById('save-file-type-selector');
7676
saveFileTypeSelector.onchange = saveData;
77+
addSaveOptions(saveFileTypeSelector);
7778

7879
// restore previous table view state
7980
viewState = vscode.getState();

web/scripts/tabulator.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,21 @@ window.addEventListener('resize', function () {
6767
}
6868
});
6969

70+
/**
71+
* Adds supported data format save options
72+
* to the tabular data view toolbar Save dropdown.
73+
*
74+
* @param {*} saveFileTypeSelector Save dropdown UI component.
75+
*/
76+
function addSaveOptions(saveFileTypeSelector) {
77+
// add save semicolon delimited, tsv, json, and html table options
78+
saveFileTypeSelector.innerHTML += `
79+
<option value="ssv">;;; csv</option>
80+
<option value="tsv">⇥ tsv</option>
81+
<option value="json">{} &nbsp;json</option>
82+
<option value="html">&lt;/&gt; &nbsp;html</option>`;
83+
}
84+
7085
/**
7186
* Creates new Tabulator table with initial set of data to display.
7287
*

web/styles/table-view.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ body {
3131
position: absolute;
3232
top: 5px;
3333
right: 0px;
34-
width: 260px;
34+
width: 264px;
3535
height: 32px;
3636
padding-left: 5px;
3737
background-color: var(--vscode-editor-background);

0 commit comments

Comments
 (0)