Description
A little background for reminder:
In #12, we implemented this change to the select.html
template:
- ng-options="val as name for (val,name) in form.titleMap">
+ ng-options="val as form.titleMap[val] for val in form.schema.enum">
This was later reverted after the discussion in #23 with f119fb1#diff-b7fb23ab1fda485328f4ece15a745a38R10. The new internal titleMap
list should have the correct sort order so I dug a little deeper.
I believe the issue is here: f119fb1#diff-7322ca889abbb7d0f0e6de922b7e4838R59. canonicalTitleMap
is iterating over schema.enumNames
when it should be iterating over enum
. Otherwise the order can be determined by enumNames
(an object, without a guaranteed order) rather than the enum
list itself.
You can reproduce the issue by visiting the Bootstrap Example page and pasting ["*"]
for Form and the following for Schema:
{
"type": "object",
"properties": {
"thing": {
"type": "string",
"title": "Thing",
"enum": ["b", "a"],
"enumNames": {"a": "The A", "b": "The B"}
}
}
}
enum
has "b"
listed first, but it appears second in the select options.