我对数据服务器端有问题。
我的表索引url地址是address.com/customers/edit/39。我第一次从address.com/customers/datatable/39获得数据,但随后我过滤 - 数据表请求网址是address.com/customers/edit/39。我用:
<script src="//cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js"></script>
// Data tables
$('#customers-list-data').dataTable({
processing: true,
serverSide: true,
ajax: '/customers/datatable/39',
columns: [
{ data: 'first_name', name: 'first_name' },
{ data: 'last_name', name: 'last_name' },
{ data: 'phone', name: 'phone' },
{ data: 'country', name: 'country' },
{ data: 'city', name: 'city' },
{ data: 'address', name: 'address' },
{ data: 'email', name: 'email' },
{ data: 'action', name: 'action', orderable: false, searchable: false}
],
pagingType : 'full_numbers',
dom: '<"dt-top-row"Bfl>r<"dt-wrapper"t><"dt-row dt-bottom-row"<"row"<"col-sm-6"i><"col-sm-6 text-right"p>>>',
buttons: [
{
extend: 'collection',
text: 'Save <span class="caret" />',
buttons : ['csvFlash', 'excelFlash', 'pdfFlash']
},
'colvis'
]
}).columnFilter({
sPlaceHolder: "head:after",
aoColumns: [
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
null
]
});
首次重新加载页面请求网址:http://address.com/customers/datatable/39?draw=1
过滤输入请求网址后的:http://address.com/customers/edit/39?draw=2(我的浏览器网址为http://address.com/customers/edit/39)
columnFilter.js并未正确请求正确的网址