datatable 라이브러리를 사용하던 도중, 데이터를 불러와 넣을 때 조건에 따라 <tr>에 css를 적용해야 했다.
<tr>에 속성 추가하기createdRow: function(row, data, dataIndex, full) { $(row).css('text-decoration', 'line-through'));
function callback(data) {
table1 = #('#table').DataTable({
"data":data,
"columns":[
{"data":"col1"}
,{"data":"col2"}
,{"data":"col3"}
],
"coulmnDefs":[
{targets:0, width:"100px"}
,{targets:1, width:"100px"}
,{targets:2, width:"100px"}
],
createdRow: function(row, data, dataIndex, full) {
$(row).css('text-decoration', 'line-through'));
}
},
});
<tr>의 <td>에 접근하기$(row).children('td:nth-child(1)').css('text-decoration', 'line-through');