-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Regarding the recent propertyOrder change (discussed/added in #110 )
Applying properyOrder to an array with format: table, I see the headers get sorted to match the propertyOrder, but the editors for each of the items in the table do not.
As a simple example, below is a schema for an array whose items are objects, each with two properties, TextField and ChoiceField. (Both being strings, but with an enum for the ChoiceField, solely to make obvious what's happening)
This renders as a table with headings ordered TextField then ChoiceField, but the editors for the rows are ordered with the ChoiceField's values before the TextField
I suspect the error comes somewhere around https://github.com/jdorn/json-editor/blob/master/dist/jsoneditor.js#L2596 , where editor_holder is built based on this.schema.properties. Later in the code, if I'm reading it correctly, self.editors gets sorted. However, because the editor_holder was already generated, and not getting re-sorted, it renders in the original order, not the sorted order
Example: (Reproducible for me in http://jeremydorn.com/json-editor/)
Schema:
{
"type": "object",
"properties": {
"OuterArray": {
"type": "array",
"items": {
"type": "object",
"properties": {
"FieldA": {
"type": "string",
"enum": [
"OptionA1",
"OptionA2"
],
"propertyOrder": 10
},
"FieldB": {
"type": "string",
"propertyOrder": 5
}
}
},
"format": "table"
}
}
}