我在Thymeleaf模板中定义了这个数据表,但它似乎不起作用,因为它只加载一次数据。
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script th:inline="javascript">
/*<![CDATA[*/
$(document).ready(function (){
var table = $('#deviceTable').DataTable({
"info": false,
"lengthChange": false,
"paging": false,
"searching": false,
"ajax": ' http://127.0.0.1:5678/telefonicaUtils/api/aggreg/datatableList',
"columns": [
{ data: 'numCalculatedPhones' },
{ data: 'day' },
{ data: 'companyName' }
]
});
setInterval(function () {
var table = $('#deviceTable').DataTable();
table.fnReloadAjax();
}, 1);
});
/* -]*/
/*]]>*/
</script>