mirror of
https://github.com/nasa/openmct.git
synced 2024-12-19 05:07:52 +00:00
[table] #707 Fixed sorting on insert for numbers
Added metadata to event generator
This commit is contained in:
parent
7da1a218ba
commit
a56edb9ff4
@ -66,6 +66,8 @@ define([
|
||||
],
|
||||
"ranges": [
|
||||
{
|
||||
"key": "message",
|
||||
"name": "Message",
|
||||
"format": "string"
|
||||
}
|
||||
]
|
||||
|
@ -262,13 +262,17 @@ define(
|
||||
sortKey = this.$scope.sortColumn;
|
||||
|
||||
function binarySearch(searchArray, searchElement, min, max){
|
||||
var sampleAt = Math.floor((max - min) / 2) + min;
|
||||
|
||||
var sampleAt = Math.floor((max - min) / 2) + min,
|
||||
valA,
|
||||
valB;
|
||||
if (max < min) {
|
||||
return min; // Element is not in array, min gives direction
|
||||
}
|
||||
|
||||
switch(self.sortComparator(searchElement[sortKey].text, searchArray[sampleAt][sortKey].text)) {
|
||||
valA = isNaN(searchElement[sortKey].text) ? searchElement[sortKey].text : parseFloat(searchElement[sortKey].text);
|
||||
valB = isNaN(searchArray[sampleAt][sortKey].text) ? searchArray[sampleAt][sortKey].text : searchArray[sampleAt][sortKey].text;
|
||||
|
||||
switch(self.sortComparator(valA, valB)) {
|
||||
case -1:
|
||||
return binarySearch(searchArray, searchElement, min, sampleAt - 1);
|
||||
case 0 :
|
||||
|
Loading…
Reference in New Issue
Block a user