Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintain enum order for select options #12

Merged
merged 1 commit into from Jun 30, 2014
Merged

Maintain enum order for select options #12

merged 1 commit into from Jun 30, 2014

Conversation

adamschwartz
Copy link
Contributor

Maintains the original sort order of an enum for string types which result in the select.html template.

Using an orderBy filter is another option, but I think this is more readable.

davidlgj added a commit that referenced this pull request Jun 30, 2014
@davidlgj davidlgj merged commit 21b4974 into json-schema-form:development Jun 30, 2014
@davidlgj
Copy link
Contributor

Yeah this feels more correct, since the order of an object isn't really a guarantee. I feel we might want to add an "orderBy" option or some such later as well, just so you can override the order in the form definition.

Thanks!

@fiddur
Copy link

fiddur commented Jun 30, 2014

The original enum isn't an object, it's an array, so THAT order can be maintained.

...just sayin :)

@adamschwartz
Copy link
Contributor Author

@davidlgj Thanks! Note that by default Angular was alphabetically sorting titleMap used in the ng-options, hence how I noticed this in the first place.

@fiddur I believe @davidlgj was referring to titleMap when he said "the order of an object isn't really a guarantee".

@adamschwartz adamschwartz deleted the enum-maintain-order-select-options branch June 30, 2014 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants