Datatable : on init load data for the first page

This commit is contained in:
acognet
2021-08-20 15:54:16 +02:00
parent e095749c90
commit 280afb35a9
5 changed files with 130 additions and 68 deletions

View File

@@ -8,7 +8,7 @@
//
var numberCachePages = 5;
$.fn.dataTable.pipeline = function (opts) {
$.fn.dataTable.pipeline = function (opts, initJson) {
// Configuration options
var conf = $.extend({
pages: numberCachePages, // number of pages to cache
@@ -75,8 +75,12 @@ $.fn.dataTable.pipeline = function (opts) {
ajax = true;
}
}
if (settings.clearCache) {
if (request.draw == 1 && initJson != null) {
//do nothing
cacheLastJson = $.extend(true, {}, initJson);
cacheLower = 0;
cacheUpper = initJson.data.length;
} else if (settings.clearCache) {
// API requested that the cache be cleared
ajax = true;
settings.clearCache = false;