0
私はこれまでこれをしてきました。完全にロードされた後、テーブルは完全に表示されました。私はt.ajax.reload()
を追加したときしかし、それは、任意の提案はapreciatedされますTypeError: t.ajax is undefined
DataTable()でajax.reload()を呼び出すと、undefinedが返されるのはなぜですか?
$.fn.dataTableExt.oApi.fnPagingInfo = function(oSettings)
{
return {
"iStart": oSettings._iDisplayStart,
"iEnd": oSettings.fnDisplayEnd(),
"iLength": oSettings._iDisplayLength,
"iTotal": oSettings.fnRecordsTotal(),
"iFilteredTotal": oSettings.fnRecordsDisplay(),
"iPage": Math.ceil(oSettings._iDisplayStart/oSettings._iDisplayLength),
"iTotalPages": Math.ceil(oSettings.fnRecordsDisplay()/oSettings._iDisplayLength)
};
};
var t = $("#mytable").dataTable({
initComplete: function() {
var api = this.api();
$('#mytable_filter input')
.off('.DT')
.on('keyup.DT', function(e) {
if (e.keyCode == 13) {
api.search(this.value).draw();
}
});
},
oLanguage: {
sProcessing: "loading..."
},
processing: true,
serverSide: true,
ajax: {"url": "data/json", "type": "POST"},
columns: [
{
"data": "id",
"orderable": false
},
{"data": "nama"},
{"data": "stok"},
{"data": "satuan"},
{
"data" : "action",
"orderable": false,
"className" : "text-center"
}
],
order: [[0, 'desc']],
rowCallback: function(row, data, iDisplayIndex) {
var info = this.fnPagingInfo();
var page = info.iPage;
var length = info.iLength;
var index = page * length + (iDisplayIndex + 1);
$('td:eq(0)', row).html(index);
}
});
setInterval(function() {
t.ajax.reload();
}, 3000);
示しています。前もって感謝します!
が、それは動作しますが、どうもありがとうございました。.. – Ukasyah