bug fix: 修复HTTPCookieManager表格复制粘贴行数据时报错Boolean数值的问题

This commit is contained in:
azhengzz 2021-04-04 23:54:43 +08:00
parent be59657a30
commit b387a4466c
1 changed files with 16 additions and 0 deletions

View File

@ -99,9 +99,25 @@ function getHTTPCookieManagerToolElement(tool_id) {
language: 'zh-CN',
// 是否允许无效数据 默认 true
allowInvalid: false,
afterPaste: afterPasteHookForTableParam,
};
let $container = $(`#table-http-cookie-manager-${tool_id}`);
element.obj.table_http_cookie_manager = $container.handsontable(option_table_http_cookie_manager).handsontable('getInstance');
// 解决复制粘贴后checkBox中的值由布尔类型变为字符串的问题
function afterPasteHookForTableParam() {
let data = element.obj.table_http_cookie_manager.getSourceData();
for (let i = 0; i < data.length; ++i) {
let row = data[i];
if (row.secure === 'false'){
row.secure = false;
}
if (row.secure === 'true'){
row.secure = true;
}
}
element.obj.table_http_cookie_manager.loadData(data);
}
}
function saveTool() {