Why table.ajax.url().load() didn't work?
Why table.ajax.url().load() didn't work?
walli
Posts: 4Questions: 3Answers: 0
I really see the server return new data, but the datatable still show the old data.
how can I refresh the datatable?
var table = $('#questionTable').DataTable({
"jQueryUI": true,
"destory": true,
"ordering": false,
"searching": false,
"paging": true,
"language": {
...
}
},
"columnDefs": [
{"bSearchable": false, "bVisible": false, "aTargets": [0]},
{"bSearchable": false, "bVisible": false, "aTargets": [1]},
{"bSearchable": false, "bVisible": false, "aTargets": [2]}
],
"processing": false,
"serverSide": true,
"ajax": "${context}/question/list.htm",
"columns": [
{"data": "id"},
{"data": "userId"},
{"data": "time"},
{"data": "question"}
]
});
$('#myQuestion').click(function () {
if (login()) {
var userId = $.cookie("userId");
table.ajax.url("${context}/question/my.htm?userId=" + userId).load();
}
});
This discussion has been closed.
Answers
Looks like it should work to me. Please link to a test case showing the issue.
Allan
Thanks Alian, but I finally found the reason, still thanks