我有一个问题,已经花了几个小时,我无法解决,我使用 DataTable 如下:
<script type="text/javascript" language="javascript" >
$(document).ready(function() {
console.log("Entrou na função");
var dataTable = $('#employee-grid').DataTable( {
"destroy": true,
"processing": true,
"serverSide": true,
"ajax":{
url :"phpmysql_serverside.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">Sem registros</th></tr></tbody>');
$("#employee-grid_processing").css("display","none");
}
}
} );
} );
这里通常用于搜索字段,但是当我把这个脚本放在下面来翻译搜索工作时,因为fucei根本就没有想到这个问题。
<script type="text/javascript" language="javascript" >
$(document).ready(function(){
$('#employee-grid').dataTable( {
//paging: false, // desativa paginação
//ordering: false, //desativa ordenação no cabeçalho
//searching: false, // desativa a pesquisa no topo
"bDestroy": true,
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
iDisplayLength: 25,
iDisplayStart: 3,
"oLanguage": {
"sProcessing": "Procesando...",
"sZeroRecords": "Nenhum registro encontrado",
"sLengthMenu": "Mostrando _MENU_ resultados por página",
"sInfo": "Mostrando de _START_ até _END_ de _TOTAL_ registros",
"sInfoEmpty": "Mostrando 0 até 0 de 0 registros",
"sInfoFiltered": "(Filtrados de _MAX_ total registros)",
},
sPagination: "full_numbers",
bStateSave: true,
sScorollX: "300px",
sScrollY: "550px",
bScrollInfinite:true, //this property disables pagination
oSearch: { "sSearch": "Digite Aqui...", "bRegex": false, "bSmart": false }
});
});
</script>
PS:我的 PHP 页面正常运行,因为我使用第二个脚本时只会出现问题。