Skip to content

Commit

Permalink
allow client customize their own filename (#2188)
Browse files Browse the repository at this point in the history
* allow client customize their own filename

* Update sqlquery.html
  • Loading branch information
te87037 committed Jun 16, 2023
1 parent 4bca447 commit 59c89bc
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion sql/templates/sqlquery.html
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,26 @@ <h4 class="modal-title text-danger">收藏语句</h4>
exportTypes: ['json', 'sql', 'csv', 'txt', 'xml', 'xlsx'],
exportOptions: {
//ignoreColumn: [0], //忽略某些列的索引数组
fileName: 'export_result' //文件名称设置
fileName: function () {
var userInput = prompt('请输入文件名:'); // 弹出对话框让用户输入文件名
return userInput || 'export_result'; // 若用户未输入文件名则使用默认文件名
},
onFileSave: function (e) {
var url = e.currentTarget.href;
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'blob';
xhr.onload = function () {
if (xhr.status === 200) {
var blob = xhr.response;
var downloadLink = document.createElement('a');
downloadLink.href = window.URL.createObjectURL(blob);
downloadLink.click();
}
};
xhr.send();
return false;
}
},
undefinedText: '(null)',
detailView: isdetail, //开启显示行首"+"
Expand Down

0 comments on commit 59c89bc

Please sign in to comment.