我正在尝试使用数据表搜索在datatable内部的select2中搜索值。我表中的所有td单元格均为select2。下面的代码:
$(document).ready( function () {
$('#datatable')
.addClass( 'nowrap' )
.dataTable( {
responsive: true,
columnDefs: [
{ targets: [-1, -3], className: 'dt-body-right' }
],
drawCallback: function() {
$('.dt-select2').select2();
}
});
$('.dataTables_filter input[type="search"]').attr('placeholder','Search in this page ....').css({'display':'inline-block'});
$('.dataTables_filter input[type="search"]').focus();
});