`boundaryScale` option of Scroller ignored?
`boundaryScale` option of Scroller ignored?

Hi everybody,
while trying to tune the values for the Scroller extension in my project, I noticed that changes to the value of boundaryScale
basically show weird effects?!
Some excerpt from my DT initialization:
options = {
"processing": true,
"serverSide": true,
"paging": true,
"pageLength": 25,
"ajax": iniData["dataUrl"],
"order": iniData["order"],
"columnDefs": iniData["columnDefs"],
"dom": "lrtip",
"searching": true,
"createdRow": function(row, data, idx){
// Highlight rows for ratings
if (data.indexOf("critical") > -1) {
$(row).addClass("highlight-critical");
}
if (data.indexOf("important") > -1) {
$(row).addClass("highlight-important");
}
// Highlight rows for KPIs
data.forEach(function(item, index){
if (typeof item == typeof "") {
if (item.indexOf("KPI:") > -1 && item.indexOf("KPI: Other") < 0) {
$(row).addClass("highlight-kpi");
}
}
});
},
"autoWidth": false
}
options["scrollY"] = $("#overview_tabcontent").innerHeight() - 160;
options["scroller"] = {
"displayBuffer": 9,
"boundaryScale": 1,
"loadingIndicator": true,
"serverWait": 100
};
oTable = $(iniData["tableId"]).DataTable(options);
Watching the AJAX requests made by DataTables/Scroller seem a bit weird to me; depending on the value of boundaryScale
the behavior is weird in different ways. In the table I have listed the values of the start
and length
parameters of these requests
boundaryScale = 1
IMHO the first request after initialization is done way too early! If I have X rows in the table, I should be able to scroll to the last row present in the table before another AJAX request is made. The following AJAX requests look fine: New data is loaded when I have reached the last row.
displayBuffer = 9
Event | start | length | rows returned |
---|---|---|---|
Initialization | 0 | 117 | 100 |
Scrolled down approx. to position 50 | 10 | 81 | 81 |
Scrolled down approx. to position 80 | 44 | 81 | 81 |
Scrolled down approx. to position 120 | 82 | 81 | 81 |
displayBuffer = 7
Event | start | length | rows returned |
---|---|---|---|
Initialization | 0 | 91 | 91 |
Scrolled down to approx. position 25 | 2 | 63 | 63 |
Scrolled down to approx. position 60 | 32 | 63 | 63 |
Scrolled down to approx. position 90 | 60 | 63 | 63 |
boundaryScale = 1, displayBuffer = 7
Event | start | length | rows returned |
---|---|---|---|
Initialization | 0 | 91 | 91 |
Scrolled down to approx. position 30 | 4 | 63 | 63 |
Scrolled down to approx. position 55 | 26 | 63 | 63 |
Scrolled down to approx. position 85 | 50 | 63 | 63 |
Scrolled down to approx. position 100 | 72 | 63 | 63 |
Answers
This is in part related to the fact that the table is empty when a server-side processing table is initialised. The calculation to get the number of rows is "confused" by that (the
pageLength: 25
is more or less ignored) resulting in what you see.I agree, this is a pain point with Scroller and it is something I should address.
Allan