- 注册时间
- 2014-7-21
- 最后登录
- 2022-7-26
- 阅读权限
- 150
- 积分
- 18264
- 精华
- 0
- 帖子
- 8338
|
本帖最后由 dforce 于 2019-4-10 18:03 编辑
不允许修改的列加readOnly="true"
copyexcel.js修改- function setRowValues(row, columnIndex, values) {
- var valMap = {};
- for (var i = 0, l = values.length; i < l; i++) {
- var column = columns[columnIndex + i];
- if (!column) continue;
- if (column.readOnly) continue; //多加一下这行判断
- var value = values[i];
- if (value[0] == '"' && value[value.length - 1] == '"') {
- value = value.substring(1, value.length - 1);
- value = value.replace("\"\"", "\"");
- }
- valMap[column.field] = value;
- }
- grid.updateRow(row, valMap);
- }
- function getValueArrayFromGrid(grid) {
- var range = me.cellRange;
- var array = [];
- if (range) {
- var columns = grid.getVisibleColumns();
- for (var i = range.startRow, l = range.endRow; i <= l; i++) {
- var textArray = [];
- array.push(textArray);
- var row = grid.getAt(i);
- for (var j = range.startCol, k = range.endCol; j <= k; j++) {
- var column = columns[j];
- if (column.readOnly) continue; //这里添加
- var val = row[column.field];
- if (mini.isNull(val)) val = "";
- textArray.push(val);
- }
- }
- }
- return array;
- }
复制代码 |
|