So I'm trying to implement a sort of data table view with in React Native. All I really need to do is sort the columns. The data structure I am trying to sort is sorta like this:
[
[
element,
element,
(9 elements per array)
],
[
element,
element,
(9 elements per array)
]
]
where I have a total of 170+ arrays in the base array and each child array has 9 elements.
I've been able to accomplish the sorting using essentially this method:
return items.sort(function(a,b) {
return a[col].value > b[col].value ? 1:-1
})
The problem I run into is that the sort takes a good second or two. I don't notice this delay with web data tables so I'm wondering if there is some sort of sorting algorithm I should be using for a faster sort? Should I possibly be structuring my data differently (though I was having similar results by having an array of objects)?
valueis a number, usereturn a[col].value - b[col].value0when they are.