我在HTML中使用了两个数据表,直到我无法从窗口中滚动出表头为止,一切都很好。
发生这种情况时,表标题会显示在页面底部。
当我的窗口足够容纳桌子时,如下所示:
。
这是我第一次向下滚动时的样子:
当然,如果我向下滚动足以使所有两个标题都消失,则将所有两个标题依次显示:
这是我的DataTables代码的样子:
$('#sajattevtablazat').DataTable( {
"ajax": "../controller/ajax.php?mit=LekerSajatTablaJson",
"columns": [
{
"class": "reszletek",
"data": 0,
},{
"class": "reszletek",
"data": 1
}
],
"scrollXInner": true,
"scrollYInner": true,
"colReorder": false,
"responsive": false,
"autoWidth": false,
fixedHeader: false,
iDisplayLength: 5,
dom: '<"text-center"i><"row"<"col"p><"col"f>><"container-fluid mx-auto"t>',
fixedHeader: {
header: true,
footer: false
},
"columnDefs": [
{
"render": function ( data, type, row ) {
if(row[2]=="1"){
return "<input class='form-control' disabled checked type='checkbox'>";
}else{
return "<input class='form-control' disabled type='checkbox'>";
}
},
"targets": 2
},
{
"render": function ( data, type, row ) {
if(row[3]==1){
return "<input class='form-control' disabled checked type='checkbox'>";
}else{
return "<input class='form-control' disabled type='checkbox'>";
}
},
"targets": 3
},
{
"render": function ( data, type, row ) {
return '<a href="../view/view-taskkezel.php?id='+row[0]+'" target="kozepso"><i class="material-icons">edit</i></a>';
},
"targets": 4
},
{
"render": function ( data, type, row ) {
var szoveg="Biztosan le akarja zárni ezt a taszkot: "+row[0]+"?";
return '<!--href="../controller/controller-taszk.php?del='+row[0]+'"--><a class="confirmation" href="#" onclick="return confirm("ok ok") "><i class="material-icons">check_circle_outline</i></a>';
},
"targets": 5
}
]
,"language": {
"url":"../include/js/Hungarian.json",
}
} );