|
@@ -404,21 +404,25 @@ $(document).ready(function() {
|
|
|
}
|
|
|
}
|
|
|
// 获取更新数据
|
|
|
- if (info.editingText) {
|
|
|
- const num = _.toNumber(info.editingText);
|
|
|
- if (num) {
|
|
|
- data[col.field] = num;
|
|
|
- } else {
|
|
|
- try {
|
|
|
- data[col.field] = math.evaluate(transExpr(info.editingText));
|
|
|
- } catch(err) {
|
|
|
- toastr.error('输入的表达式非法');
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- return;
|
|
|
+ if (col.type === 'Number') {
|
|
|
+ if (info.editingText) {
|
|
|
+ const num = _.toNumber(info.editingText);
|
|
|
+ if (num) {
|
|
|
+ data[col.field] = num;
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ data[col.field] = math.evaluate(transExpr(info.editingText));
|
|
|
+ } catch(err) {
|
|
|
+ toastr.error('输入的表达式非法');
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ data[col.field] = null;
|
|
|
}
|
|
|
} else {
|
|
|
- data[col.field] = null;
|
|
|
+ data[col.field] = info.editingText;
|
|
|
}
|
|
|
// 更新至服务器
|
|
|
postData(window.location.pathname + '/update', {postType: 'update', postData: data}, function (result) {
|
|
@@ -1614,7 +1618,7 @@ $(document).ready(function() {
|
|
|
}, function (result) {
|
|
|
const refreshNode = mainTree.loadPostData(result);
|
|
|
treeOperationObj.refreshTree(mainSheet, refreshNode);
|
|
|
- sheet.setSelection(refreshNode.create[0].index, sel.col, sel.rowCount, sel.colCount);
|
|
|
+ mainSheet.setSelection(refreshNode.create[0].index, sel.col, sel.rowCount, sel.colCount);
|
|
|
treeOperationObj.refreshOperationValid(mainSheet);
|
|
|
});
|
|
|
});
|
|
@@ -1679,7 +1683,7 @@ $(document).ready(function() {
|
|
|
const refreshData = mainTree.loadPostData(result);
|
|
|
treeOperationObj.refreshTree(mainSheet, refreshData);
|
|
|
const sel = mainSheet.getSelections()[0];
|
|
|
- sheet.setSelection(refreshData.create[0].index, sel.col, sel.rowCount, sel.colCount);
|
|
|
+ mainSheet.setSelection(refreshData.create[0].index, sel.col, sel.rowCount, sel.colCount);
|
|
|
treeOperationObj.refreshOperationValid(mainSheet);
|
|
|
});
|
|
|
});
|