$(document).ready(function() {
var mainData = $('#mainData').DataTable( {
processing : true, // show indicator
serverSide : true,
scrollY: '52vh',
scrollCollapse: true,
searching : false,
lengthChange : false,
pageLength: 30,
pagingType: 'simple_numbers',
language: {
paginate: {
previous: '«',
next: '»'
},
},
columnDefs:[{targets:[3,4], orderable:false},
{targets:[1], width:'15%'},
{targets:[9], defaultContent: '<button class="btn btn-xs btn-success" data-toggle="modal" data-backdrop="static" type="button">기본정보 관리</button>'},
{targets:[0,2,3,4,5,6,7,8], className:'dt-head-center'},
{targets:[8], width:'5%', render:function (data) {
return data.substring(0,4) + '-' + data.substring(4,6) + '-' + data.substring(6,8) + ' ' + data.substring(8,10) + ':' + data.substring(10,12) + ':' + data.substring(12,14);
}
}
],
ajax: {
url : './manage.do?command=getCompanyList',
data : function(d){
d.searchType = $('#searchType').val();
d.searchData = $('#searchData').val();
},
dataSrc: 'rows'
},
order: [1, 'asc'],
columns: [
{ data: 'client_comp_seq' },
{ data: 'business_nm' },
{ data: 'client_comp_nm' },
{ data: 'represen_nm' },
{ data: 'telno' },
{ data: 'email' },
{ data: 'prodcount' },
{ data: 'use_yn' },
{ data: 'reg_time' }
]
} );
{targets:[8], width:'5%', render:function (data) {
return data.substring(0,4) + '-' + data.substring(4,6)
+ '-' + data.substring(6,8) + ' ' + data.substring(8,10)
+ ':' + data.substring(10,12) + ':' + data.substring(12,14);
}
}
이렇게 function 안에 data를 매개변수로 넣어서 20191011141414 이런 형식을 subString 으로 잘라서 표시한다.
그럼 2019-10-11 14:14:14 이렇게 표현을 할 수 있다.