mirror of
https://github.com/nasa/openmct.git
synced 2025-01-30 08:04:03 +00:00
Fix insertion point scan
This commit is contained in:
parent
0588f9190a
commit
01d93306f3
@ -437,15 +437,21 @@ define(
|
|||||||
*/
|
*/
|
||||||
MCTTableController.prototype.findInsertionPoint = function (searchArray, searchElement) {
|
MCTTableController.prototype.findInsertionPoint = function (searchArray, searchElement) {
|
||||||
var index;
|
var index;
|
||||||
var textIndex;
|
var testIndex;
|
||||||
var first = searchArray[0];
|
var first = searchArray[0];
|
||||||
var last = searchArray[searchArray.length - 1];
|
var last = searchArray[searchArray.length - 1];
|
||||||
|
|
||||||
|
if (first) {
|
||||||
|
first = first[this.$scope.sortColumn].text;
|
||||||
|
}
|
||||||
|
if (last) {
|
||||||
|
last = last[this.$scope.sortColumn].text;
|
||||||
|
}
|
||||||
// Shortcut check for append/prepend
|
// Shortcut check for append/prepend
|
||||||
if (first && this.sortComparator(first, searchElement) <= 0) {
|
if (first && this.sortComparator(first, searchElement) >= 0) {
|
||||||
index = testIndex = 0;
|
index = testIndex = 0;
|
||||||
} else if (last && this.sortComparator(last, searchElement) >= 0) {
|
} else if (last && this.sortComparator(last, searchElement) <= 0) {
|
||||||
index = testIndex = searchArray.length - 1;
|
index = testIndex = searchArray.length;
|
||||||
} else {
|
} else {
|
||||||
// use a binary search to find the correct insertion point
|
// use a binary search to find the correct insertion point
|
||||||
index = testIndex = this.binarySearch(
|
index = testIndex = this.binarySearch(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user