【发布时间】:2017-09-28 04:12:29
【问题描述】:
请帮我解决问题,js colvis 在我的项目中不起作用。这是来源:
<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>
【问题讨论】:
标签: javascript codeigniter view datatables