From 84e20433b6db60802b27278b5a1adf735a10180d Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 22 May 2014 14:48:22 +0000 Subject: [PATCH] Attempt to get rows in the direction of need, rather than centered on the missing rows --- etemplate/js/et2_dataview_controller.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/etemplate/js/et2_dataview_controller.js b/etemplate/js/et2_dataview_controller.js index 6562ba4904..259c7caa19 100644 --- a/etemplate/js/et2_dataview_controller.js +++ b/etemplate/js/et2_dataview_controller.js @@ -413,7 +413,7 @@ var et2_dataview_controller = Class.extend({ // Queue fetching that data range if (needsData !== false) { - this._queueFetch(et2_bounds(needsData, _idxEnd + 1), false); + this._queueFetch(et2_bounds(needsData, _idxEnd + 1), needsData == _idxStart ? 0 : needsData > _idxStart ? 1 : -1, false); } }, @@ -421,7 +421,7 @@ var et2_dataview_controller = Class.extend({ * The _queueFetch function is used to queue a fetch request. * TODO: Refresh is currently not used */ - _queueFetch: function (_range, _isUpdate) { + _queueFetch: function (_range, _direction, _isUpdate) { // Force immediate to be false _isUpdate = _isUpdate ? _isUpdate : false; @@ -433,7 +433,7 @@ var et2_dataview_controller = Class.extend({ { if (typeof this._queue[i] === "undefined") { - this._queue[i] = 1; // Stage 1 -- queued + this._queue[i] = _direction; // Stage 1 - queue for after current, -1 -- queue for before current } } @@ -472,13 +472,13 @@ var et2_dataview_controller = Class.extend({ key = parseInt(key); - var b = Math.max(0, key - r); - var t = Math.min(key + r, total - 1); + var b = Math.max(0, key - r + (r * this._queue[key])); + var t = Math.min(key + r + (r * this._queue[key]), total - 1); var c = 0; for (var i = b; i <= t && c < ET2_DATAVIEW_STEPSIZE; i ++) { if (typeof this._queue[i] == "undefined" - || this._queue[i] === 1) + || this._queue[i] <= 1) { this._queue[i] = 2; // Stage 2 -- pending or available marked[i] = true;