Web/front-end

[DataTables] column grouping

hjkongkong 2022. 2. 26. 16:38

column들을 그룹핑하는 방법

이렇게 나누어서 그룹핑을 하겠다.

<thead> 태그 밑에 그룹핑 관련 코드를 넣으면 된다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<thead>
 
<!-- Complex headers -->
    <tr>
        <th rowspan="2">Name</th>
        <th colspan="3">group1</th>
        <th colspan="2">group2</th>
    </tr>
<!-- Complex headers end -->
    <tr>
        <!-- 
        <th>Name</th>
        -->
        <th>Position</th>
        <th>Office</th>
        <th>Age</th>
        <th>Start date</th>
        <th>Salary</th>
    </tr>
</thead>
cs

 

적용 완료

참고 : https://datatables.net/examples/basic_init/complex_header.html