728x90
반응형
,"footerCallback" : function ( row, data, start, end, display ) {
var api = this.api();
var numFormat = $.fn.dataTable.render.number(',').display;
for(i=3; i<9; i++){
total = api.column( i, {page:'current'} ).data().sum();
if(i<7){
$( api.column( (i-minus) ).footer() ).html(numFormat(total));
}else{
$( api.column( (i-minus) ).footer() ).html(numFormat(total)).append('%');}
}
$( api.column( 0 ).footer() ).html('합계').attr('colspan', colspan);
$( api.column( 1 ).footer() ).addClass('txr');
$( api.column( 2 ).footer() ).addClass('txr');
}
$( api.column( 0 ).footer() ).html('합계').attr('colspan', colspan);
➕ 알아야할 것은 datatables에서 colsapan으로 합쳐진 cell은 2개가 합쳐졌든 3개가 합쳐졌든 1개의 cell로 인지한다.
그래서 내가 0번째 cell에 colspan속성을 부여했는데 3개의 cell 을 합친것이였다.
tobody로 봤을 때는 index가 3인 (4번째 cell)이 footer에서는 index가 1 (2번째)이다.
그래서 설정하는데 머리가 복잡했었다.
colspan기능 좀 넣어주지요....ㅎㅎㅎㅎㅎ
728x90
반응형
'Front > JS & jQuery' 카테고리의 다른 글
[jQuery] .off() - 이벤트 해제하기 (0) | 2022.06.12 |
---|---|
[jQuery] 이벤트 중복발생 (0) | 2022.06.11 |
[jQuery] daterangepicker 사용 ( 기간 검색하기 ) (0) | 2022.06.09 |
[jQuery] 선택자 여러개 선택하기 (0) | 2022.06.07 |
[jQuery] .siblings() (0) | 2022.06.06 |