【发布时间】:2016-05-05 03:58:08
【问题描述】:
This 是一个基本的数据表小提琴。
这是default,下拉菜单将显示以下Show options 10, 25, 50, 75 and 100 records:
现在我想要工作的是"lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "All"] ],我可以在this fiddle 中使用。但是如果我使用服务器端处理,这就是All 选项对我不起作用的地方。其他人都这样做。当我选择All 时,它会显示它正在显示的数据,底部显示No data found in the server
据我所知,唯一的区别是数据来自服务器。谁能告诉我如何解决这个问题?据我所知,当我选择All 时,我发送的是length:-1,而10 是length:10,所以不知道为什么All 不起作用
$(document).ready(function() {
var dataTable = $('#employee-grid').DataTable( {
"lengthMenu" : [[ 10, 25, 50, -1 ],[ '10', '25', '50', 'All' ]],
//"pageLength": 25,
"processing": true,
"serverSide": true,
"ajax":{
url :"employee-grid-data.php", // json datasource
type: "post", // method , by default get
error: function(){ // error handling
$(".employee-grid-error").html("");
$("#employee-grid").append('<tbody class="employee-grid-error"><tr><th colspan="3">No data found in the server</th></tr></tbody>');
$("#employee-grid_processing").css("display","none");
}
}
} );
} );
【问题讨论】:
-
显示
html代码?
标签: javascript jquery html datatables