Lock DataTables table while doing ajax.url().load
Lock DataTables table while doing ajax.url().load
iweedon
Posts: 3Questions: 1Answers: 0
I have a DataTables table with cells bind to the function. On the checkbox trigger I need to reload a table but I would like to stop users from clicking on the cells while reloading table. I have got an error message: $.fn.DataTables.tables().column is not a function
var oTable = $("#table").DataTable({
"bProcessing": true,
"bPaginate": false,
"bAutoWidth": false,
"sDom": '<"tableTopS"<"tableTopSearchtrn"f>>t',
"oLanguage": {
"sEmptyTable": "AAAAA", "sSearch": "<i></i>",
},
"sAjaxSource": Iurl(),
"sAjaxDataProp": "trainers",
"aoColumns": aoColumns,
"fixedHeader": true,
"aoColumnDefs": [
{ "aDataSort": [1, 0, 3], "aTargets": [0] },
{ "aDataSort": [1, 0], "aTargets": [1] },
{ "aDataSort": [2, 3, 1, 0], "aTargets": [2] },
{ "aDataSort": [3, 1, 0], "aTargets": [3] }
],
"fnRowCallback": function (nRow, aData, iDisplayIndex) {
$(nRow).data("user_id", aData["Id"]);
for (var ii = 0; ii < subjects.length; ii++)
{
var cell = $('td:eq(' + (3 + ii) + ')', nRow);
cell.bind('click', function () { apt(this); });
}
return nRow;
}
});
$('#checkbox').click(function () {
$.fn.DataTable.tables().columns().unbind();
oTable.ajax.url(new_url).load(function () {
$.fn.DataTable.tables().columns().bind();
});
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You can use something like blockui.js for this. There are some examples on the forum if you need help with it.
Kevin
Thanks, do you mind to give a link to example?
Searching the forum for
blockui
yields these threads among others that may also help:https://datatables.net/forums/discussion/comment/160561/#Comment_160561
https://datatables.net/forums/discussion/comment/118644/#Comment_118644
Kevin
Thanks it works!