vihar
1
When working on tables, How do I sort values inside table columns?
You use the vanilla js sort
function or lodash sortBy
.
Vanilla JS
Api1.data.sort(function(a, b){
if(a.firstname < b.firstname) { return -1; }
if(a.firstname > b.firstname) { return 1; }
return 0;
})
Loadsh sortBy
{{ _.sortBy(Api1.data, [function(o) { return o.name; }]); }}