Skip to content

Commit 5121b54

Browse files
Fixed wrapperStyles array.
1 parent da43568 commit 5121b54

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

components/dash-table/src/dash-table/components/HeaderFactory.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,35 @@ export default class HeaderFactory {
123123

124124
const ops = this.getHeaderOpCells(operations, opStyles, headerOpEdges);
125125

126+
const filteredStyles = this.filterMergedCells(
127+
wrapperStyles,
128+
labelsAndIndices
129+
);
130+
126131
const headers = this.getHeaderCells(
127132
wrappers,
128133
contents,
129-
wrapperStyles,
134+
filteredStyles,
130135
headerEdges
131136
);
132137

133138
return this.getCells(ops, headers);
134139
}
135140

141+
filterMergedCells = memoizeOne((cellsArray, labelsAndIndices) => {
142+
const filteredCells = [];
143+
for (let row = 0; row < cellsArray.length; row++) {
144+
const rowCells = [];
145+
for (let col = 0; col < cellsArray[row].length; col++) {
146+
if (labelsAndIndices[row][1].includes(col)) {
147+
rowCells.push(cellsArray[row][col]);
148+
}
149+
}
150+
filteredCells.push(rowCells);
151+
}
152+
return filteredCells;
153+
});
154+
136155
getCells = memoizeOne(
137156
(opCells: JSX.Element[][], dataCells: JSX.Element[][]) =>
138157
arrayMap2(opCells, dataCells, (o, c) =>

0 commit comments

Comments
 (0)