It sounds like it should just work by default for AJAX requests, if you're wanting it to apply for sorting/processing events you might need something like the following:
Adapted from https://datatables.net/reference/event/processing You'll probably want to trigger PACE on the datatable processing event by the sounds of things:
$('#dataTable')
.on( 'processing.dt', function ( e, settings, processing ) {
if(processing){
Pace.start();
} else {
Pace.stop();
}
})
.dataTable();
Well if you want to show the PACE
for every ajax request in your application then you can specify it like below
Adding the pace options before loading it.
<script>
window.paceOptions = {
ajax: {
trackMethods: ['GET', 'POST', 'PUT', 'DELETE', 'REMOVE']
}
};
</script>
<script src="../js/progressBar/pace.min.js"></script>
This will show up your PACE progress bar for every ajax request to your server.
Is simple use this form:
$('#dataTable').on('processing.dt', function(e, settings, processing) {
if (processing) {
Pace.stop();
Pace.bar.render();
} else {
Pace.stop();
}
}).DataTable();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.