Skip to content

Commit

Permalink
sorting cqtegories (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianovide authored Jul 30, 2019
1 parent 6ab8195 commit 71d20e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/PhotoPage/SelectControlSingleValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Chip from '@material-ui/core/Chip';
import MenuItem from '@material-ui/core/MenuItem';
import CancelIcon from '@material-ui/icons/Cancel';
import { emphasize } from '@material-ui/core/styles/colorManipulator';
import _ from 'lodash';
import { getValueFromTree } from '../../utils';


Expand Down Expand Up @@ -245,9 +246,12 @@ class SelectControlSingleValue extends React.Component {
}

initializeOptions = (data) => {
const options = Object
const unsortedOptions = Object
.entries(data)
.map(([key,value]) => ({label: value.label, key: value.key }));

const options = _.sortBy(unsortedOptions, "label");

this.options = options;
this.setState({ options });
}
Expand Down

0 comments on commit 71d20e9

Please sign in to comment.