Skip to content

Commit 1677e74

Browse files
committed
update File.js for add tsv
1 parent b768ead commit 1677e74

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

js/m_apps/File.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ define([
3939

4040
this.fileExtensions = {
4141
'csv': 'csv',
42+
'tsv': 'tsv',
4243
'excel': 'xlsx',
4344
'json': 'json',
4445
'pickle': ''
@@ -72,6 +73,7 @@ define([
7273
'Read': {
7374
fileTypeId: {
7475
'csv': 'pd004',
76+
'tsv': 'pd004',
7577
'excel': 'pd123',
7678
'json': 'pd076',
7779
'pickle': 'pd079'
@@ -86,6 +88,7 @@ define([
8688
'Write': {
8789
fileTypeId: {
8890
'csv': 'pd005',
91+
'tsv': 'pd005',
8992
'excel': 'pd124',
9093
'json': 'pd077',
9194
'pickle': 'pd078'
@@ -147,7 +150,7 @@ define([
147150
_bindEventByType(pageType) {
148151
var that = this;
149152
var prefix = '#vp_file' + pageType + ' ';
150-
153+
151154
// select file type
152155
$(this.wrapSelector(prefix + '#fileType')).change(function() {
153156
var value = $(this).val();
@@ -244,7 +247,7 @@ define([
244247
renderPage(pageType) {
245248
var that = this;
246249
var prefix = '#vp_file' + pageType + ' ';
247-
250+
248251
// clear
249252
$(this.wrapSelector(prefix + '#vp_inputOutputBox table tbody')).html('');
250253
$(this.wrapSelector(prefix + '#vp_optionBox table tbody')).html('');
@@ -386,6 +389,13 @@ define([
386389
name: 'fileType',
387390
type: 'var'
388391
});
392+
// if file type is tsv
393+
var fileSelected = $("#fileType").val();
394+
// $ delimeter = '\t'
395+
if($("#fileType").val() === "tsv"){
396+
$("#delimiter").val(`\n`);
397+
}
398+
389399
var result = pdGen.vp_codeGenerator(this.uuid + ' #vp_fileRead', thisPkg, userOption.toString());
390400
sbCode.append(result);
391401
} else if (pageType == 'Write') {

0 commit comments

Comments
 (0)