Editor value is not refreshed with nested DescribedBy property
See original GitHub issueGeneral information
- json-editor version: 1.4.0-beta.0
Expected behavior
Everytime propertyType is selected, editor.getValue() function / UI JSON edit should reflect actual value of propertyTypeOptions depending on selection
Actual behavior
Editor value is not refreshed or holds previous value before selection. Without nesting as in original describedBy example seem to work ok
Steps to reproduce the behavior
Direct link LINK
{
"type": "object",
"title": "Property for Sale",
"properties": {
"propertyName": {
"type": "string",
"title": "Property Name",
"description": "The name of the property being sold"
},
"propertyType": {
"type": "string",
"title": "Property Type",
"enum": [
"",
"house",
"car",
"yacht"
]
},
"Config": {
"type": "object",
"properties": {
"propertyTypeOptions": {
"type": "object",
"title": " ",
"watch": {
"propertyType": "propertyType"
},
"options": {
"disable_properties": true,
"disable_edit_json": true,
"disable_collapse": true
},
"links": [{
"rel": "describedBy",
"href": "#/definitions/{{propertyType}}"
}]
}
},
"required": ["propertyTypeOptions"]
}
},
"required": [
"propertyName",
"propertyType",
"Config"
],
"definitions": {
"house": {
"properties": {
"address": {
"type": "string",
"title": "Address"
},
"rooms": {
"type": "integer",
"title": "Number Of Rooms"
}
}
},
"car": {
"properties": {
"brand": {
"type": "string",
"title": "Brand",
"enum": [
"Audi",
"BMW",
"Chevrolet",
"Opel",
"Mitsubishi"
]
},
"color": {
"type": "string",
"title": "Color",
"format": "color"
},
"year": {
"type": "string",
"title": "Build Year"
}
}
},
"yacht": {
"properties": {
"name": {
"type": "string",
"title": "Name"
},
"model": {
"type": "string",
"title": "Model"
},
"year": {
"type": "integer",
"title": "Year"
},
"yachtLength": {
"type": "integer",
"title": "Length"
}
}
}
}
}
Workaround
Watch field programmatically and trigger setValue/onChange
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Trouble with refreshView in Nested Components
I've attempted putting the handlers in both the child component and the parent Pane component with no difference in behavior. Lastly I tried ......
Read more >Nested ListView is not refreshed - DevExpress Support
Yes, when the List View MasterDetailMode property is set to ListViewAndDetailView and a user makes changes in its Detail View, the List View...
Read more >How to access nested object value using string so I can edit? - Stack ...
If you need it without dependencies, this function will update the value described by thearray : function setObjectValue(o, a, v) { a =...
Read more >New property in Element / Nested Content Not Being Saved ...
Under Content enter a value for the new TextString property for an existing "Feature" under a "Product"; Click Save and Publsih; Refresh the ......
Read more >Object.defineProperty() - JavaScript - MDN Web Docs
A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fix added in #401 PR.
I have posted a separate bugreport #443 with a test example. (I tried fixing it, but I just can’t pinpoint where it goes wrong.) Look at the JavaScript tab on the Playground example. It just wait for the ready event, then it deletes the JSON-Editor instance and re-create it again.
I’m going to remove DescribedBy too from my layout test case too, as I can’t make an example with the various configurable options if the editor can’t be recreated.