Skip to content

Commit ec92cb3

Browse files
authored
fix: fix the loss of column attributes due to incorrect column order (#2222)
When I try to read the excel file and display it on the page, I found that the hidden columns of some files were not parsed correctly. ## Summary I found that if the order of the column data parsed here is not positive, the subsequent attributes will be overwritten ![image](https://user-images.githubusercontent.com/45730337/222389920-684a7904-9b9f-483e-9d97-3d1c1aa3cc36.png) ![image](https://user-images.githubusercontent.com/45730337/222389824-6f1c06b6-876d-4178-98e6-b8603bfd3da6.png) ## Test plan Before modification ![image](https://user-images.githubusercontent.com/45730337/222390826-8515397d-a498-4bca-91b2-62cac42cc0ff.png) After modification ![image](https://user-images.githubusercontent.com/45730337/222391194-bb1fe799-0b29-4396-9b10-0fa44767410f.png) <!-- List with permalink into source code to prove that changes are true --> Co-authored-by: zhengcp <[email protected]>
1 parent 0c4b238 commit ec92cb3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,5 @@ _SpecRunner.html
6565
.DS_Store
6666

6767
# Ignore xlsx files generated during testing
68-
*.xlsx
68+
*.xlsx
69+
enpm-lock.yaml

lib/doc/column.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,13 @@ class Column {
297297
const columns = [];
298298
let count = 1;
299299
let index = 0;
300+
/**
301+
* sort cols by min
302+
* If it is not sorted, the subsequent column configuration will be overwritten
303+
* */
304+
cols = cols.sort(function(pre, next) {
305+
return pre.min - next.min;
306+
});
300307
while (index < cols.length) {
301308
const col = cols[index++];
302309
while (count < col.min) {

0 commit comments

Comments
 (0)