728x90
반응형
function(td, cellData, rowData, row, col)
,{ "targets" : [0,2,4,6],
'createdCell': function(td,cellData,rowData,row,col){
if(col == 0){
$(td).html(`
<div class="blue">${ cellData ? cellData : '' }</div>
<div>${ rowData.ITEM_NM_10 ? rowData.ITEM_NM_10 : '' }</div>
`)
}else if(col == 2){
$(td).html(`
<div class="blue">${ cellData ? cellData : '' }</div>
<div>${ rowData.ITEM_NM_20 ? rowData.ITEM_NM_20 : '' }</div>
`)
}else if(col == 4){
$(td).html(`
<div class="blue">${ cellData ? cellData : '' }</div>
<div>${ rowData.ITEM_NM_30 ? rowData.ITEM_NM_30 : '' }</div>
`)
}else if(col == 6){
$(td).html(`
<div class="blue">${ cellData ? cellData : '' }</div>
<div>${ rowData.ITEM_NM_50 ? rowData.ITEM_NM_50 : '' }</div>
`)
}
}
}
https://datatables.net/reference/option/columns.createdCell
columns.createdCell
columns.createdCell Since: DataTables 1.10 Cell created callback to allow DOM manipulation. Description This is a callback function that is executed whenever a cell is created (Ajax source, etc) or read from a DOM source. It can be used as a complement to
datatables.net
728x90
반응형
'Front > JS & jQuery' 카테고리의 다른 글
[jQuery][datepicker] datepicker로 월까지만 표시하기 (0) | 2022.09.07 |
---|---|
[js] 연속된 숫자 배열 만들기 - Array.from() (0) | 2022.09.06 |
[js] 백틱(``), 달러(${}) (0) | 2022.09.04 |
[jQuery] table의 마지막 tr 가져오기 (0) | 2022.09.03 |
[js] 월의 마지막 날 구하기 (0) | 2022.09.02 |