我使用datatable分页为我的项目,但长度不起作用 我在我的项目中使用这个例子 http://mbahcoding.com/tutorial/php/codeigniter/codeigniter-simple-server-side-datatable-example.html
我的数据表是ajax
我正在使用: Codeigniter 3.1
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<link href="<?php echo base_url();?>assets/web/crud/datatables/css/jquery.dataTables.min.css" rel="stylesheet">
<div style="padding-right:0px; hidden; whitespace: nowrap;">
<table id="table" class="display" cellspacing="0" dir="rtl" style="table-layout: fixed; display: block; font-size:17px; text-align:justify; max-width:100%; width:100%; margin-right:0px; font-family:BMitra; overflow-x: scroll;
whitespace: nowrap;">
<thead>
<tr>
<th style="color:#026B04; width:20px; max-width:20px; min-width:20px; font-family:BYekan;font-size:18px;">ردیف</th>
<th style="color:#9E0013; width:650px; max-width:650px; min-width:650px; font-family:BYekan;font-size:18px;">پیام</th>
<th style="color:#9E0013; width:20px; max-width:20px; min-width:20px;font-family:BYekan;font-size:18px;">ساعت</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<th style="color:#026B04; width:20px; max-width:20px; min-width:20px;"></th>
<th style="color:#9E0013; width:650px; max-width:650px; min-width:650px;"></th>
<th style="color:#9E0013; width:20px; max-width:20px; min-width:20px;"></th>
</tr>
</tfoot>
</table>
</div>
<script src="<?php echo base_url(); ?>assets/web/crud/jquery/jquery-2.2.3.min.js"></script>
<script src="<?php echo base_url(); ?>assets/web/crud/datatables/js/jquery.dataTables.min.js"></script>
<script type="text/javascript">
var jq = $.noConflict();
jq(document).ready(function() {
//datatables
table = jq('#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('tops/posts/ajax_list')?>",
"type": "POST"
},
//Set column definition initialisation properties.
"columnDefs": [
{
"targets": [ 0 ], //first column / numbering column
"orderable": false, //set not orderable
},
],
});
});
</script>