Trying to update a table with sorted values using Lodash. I have found this answer, which I am trying to implement.
Demo plunker is here - outputting sorted values to console when you click on the 'Sort' button, but does not sort and update the table values (vm.resourceGridResources.Resources
) afterwards?
Code:
var sorted = _.orderBy(results, ['Value'], ['asc']);
console.log(sorted);
//this part is not working...
var sortedCollection = _.sortBy(temp, function(item) {
return sorted.indexOf(item.ResourceId);
});
vm.resourceGridResources.Resources = sortedCollection;
Please can you advise how to resolve?