forked from extern/egroupware
Better calculation for next/previous index of sparse map
This commit is contained in:
parent
35c70fea93
commit
46c80212ba
@ -327,16 +327,17 @@ var et2_dataview_selectionManager = Class.extend(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getElementRelatively (_step) {
|
function getElementRelatively (_step) {
|
||||||
|
var total = self._total || Object.keys(self._indexMap).length;
|
||||||
|
var max_index = Math.max.apply(Math,Object.keys(self._indexMap));
|
||||||
// Get a reasonable number of iterations - not all
|
// Get a reasonable number of iterations - not all
|
||||||
var total = Math.max(1,Math.min(Object.keys(self._indexMap).length,50));
|
var count = Math.max(1,Math.min(self._total,50));
|
||||||
var count = total;
|
|
||||||
var element = null;
|
var element = null;
|
||||||
var idx = _entry.idx;
|
var idx = _entry.idx;
|
||||||
while(element == null && count > 0 && idx <= total)
|
while(element == null && count > 0)
|
||||||
{
|
{
|
||||||
count--;
|
count--;
|
||||||
element = getIndexAO(Math.max(0,
|
element = getIndexAO(Math.max(0,
|
||||||
Math.min(self._total||total - 1, idx += _step)));
|
Math.min(max_index, idx += _step)));
|
||||||
}
|
}
|
||||||
return element;
|
return element;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user