JSFiddle - React, Tailwind, and code Playground
by Hugo Carneiro
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js"></script>
JavaScript
var entries = [{
id: 14355928,
data: {
'Email': '[email protected]',
'Title': 'Consultant',
'Sectors': 'Management, Finance, Business',
'Location': 'London',
'Last Name': 'Jane',
'First Name': 'Mary',
'Age': '30'
},
order: null,
createdAt: '2020-04-02T15:53:13.926Z',
updatedAt: '2020-04-02T15:53:13.926Z',
deletedAt: null,
dataSourceId: 202547
}, {
id: 14355927,
data: {
'Email': '[email protected]',
'Title': 'Head of Product',
'Sectors': 'Software, IT, Programming, Design, Development, Management',
'Location': 'London',
'Last Name': 'Smith',
'First Name': 'John',
'Age': '34'
},
order: null,
createdAt: '2020-04-02T15:53:13.926Z',
updatedAt: '2020-04-02T15:53:13.926Z',
deletedAt: null,
dataSourceId: 202547
}, {
id: 14355926,
data: {
'Email': '[email protected]',
'Title': 'Head of Marketing',
'Sectors': 'Software, IT, Marketing, Design',
'Location': 'London',
'Last Name': 'Thomas',
'First Name': 'Jane',
'Age': '26'
},
order: null,
createdAt: '2020-04-02T15:53:13.926Z',
updatedAt: '2020-04-02T15:53:13.926Z',
deletedAt: null,
dataSourceId: 202547
}]
var results = _.orderBy(entries, ['data.[Last Name]'], ['desc']);
console.log(results);