0
请帮我解决问题,js colvis不能在我的项目中工作。这是来源:colvis jquery列的可见性没有工作
<script type="text/javascript">
var table;
$(document).ready(function() {
//datatables
table = $('#table').DataTable({
"processing": true, //Feature control the processing indicator.
"serverSide": true, //Feature control DataTables' server-side processing mode.
"order": [], //Initial no order.
// Load data for the table's content from an Ajax source
"ajax": {
"url": "<?php echo site_url('customer/ajax_list')?>",
"type": "POST",
"data": function (data) {
data.salesnama = $('#salesnama').val();
data.type = $('#type').val();
}
},
//Set column definition initialisation properties.
"columnDefs": [
{
"targets": [0], //first column/numbering column
"orderable": false, //set not orderable
},
],
});
var colvis = new $.fn.dataTable.ColVis(table); //initial colvis
$('#colvis').html(colvis.button()); //add colvis button to div with id="colvis"
});
</script>
问题是按钮colvis没有显示,我觉得这个代码同样与样本中的数据表源
此代码视图按钮colvis
<div class="col-sm-12">
<div id="colvis"> tes</div>
</div>
我尝试包括此代码,以我的剧本,但并没有工作 –
嗨,你能更具体什么不workingm控制台上是否显示错误? –