Skip to content

Commit 61140ce

Browse files
skuengneoSandro Küng
andauthored
Add missing col span logic for grouped column headers (#70)
Co-authored-by: Sandro Küng <sk@neolution.ch>
1 parent bee104b commit 61140ce

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- added missing col span property for `grouped columns` feature
13+
1014
## [5.4.1] - 2024-07-05
1115

1216
### Fixed

src/lib/ReactDataTable/ReactDataTable.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ const ReactDataTable = <TData, TFilter extends FilterModel = Record<string, neve
134134
...(header.column.getCanSort() ? { cursor: "pointer" } : {}),
135135
}}
136136
className={header.column.columnDef.meta?.headerClassName}
137+
colSpan={header.colSpan}
137138
>
138139
{header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext())}
139140

test/DataTable/__snapshots__/DataTable.test.tsx.snap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ exports[`DataTable renders correctly 1`] = `
1919
<thead>
2020
<tr>
2121
<th
22+
colspan="1"
2223
style="cursor: pointer;"
2324
>
2425
NAME
@@ -28,6 +29,7 @@ exports[`DataTable renders correctly 1`] = `
2829
/>
2930
</th>
3031
<th
32+
colspan="1"
3133
style="cursor: pointer;"
3234
>
3335
COUNT
@@ -38,6 +40,7 @@ exports[`DataTable renders correctly 1`] = `
3840
</th>
3941
<th
4042
class="header-class"
43+
colspan="1"
4144
style="background-color: blue; cursor: pointer;"
4245
>
4346
STATUS
@@ -47,6 +50,7 @@ exports[`DataTable renders correctly 1`] = `
4750
/>
4851
</th>
4952
<th
53+
colspan="1"
5054
style="cursor: pointer;"
5155
>
5256
CREATED
@@ -507,6 +511,7 @@ exports[`DataTable renders with draggable-column correctly 1`] = `
507511
<thead>
508512
<tr>
509513
<th
514+
colspan="1"
510515
style="cursor: pointer;"
511516
>
512517
NAME
@@ -516,6 +521,7 @@ exports[`DataTable renders with draggable-column correctly 1`] = `
516521
/>
517522
</th>
518523
<th
524+
colspan="1"
519525
style="cursor: pointer;"
520526
>
521527
COUNT
@@ -526,6 +532,7 @@ exports[`DataTable renders with draggable-column correctly 1`] = `
526532
</th>
527533
<th
528534
class="header-class"
535+
colspan="1"
529536
style="background-color: blue; cursor: pointer;"
530537
>
531538
STATUS
@@ -535,6 +542,7 @@ exports[`DataTable renders with draggable-column correctly 1`] = `
535542
/>
536543
</th>
537544
<th
545+
colspan="1"
538546
style="cursor: pointer;"
539547
>
540548
CREATED

0 commit comments

Comments
 (0)