Comments (6)
Maybe this works for you:
- Set
type1
andtype2
values as schemas in themselves:
var typeSchemas = {
"type1": {
"type": "object",
"properties": {
"title": {
"type": "string",
"title": "Title 1"
},
"gender": {
"type": "string",
"title": "Gender",
"enum": [
"m",
"f"
]
}
},
},
"type2": {
"type": "object",
"properties": {
"title": {
"type": "string",
"title": "Title 2"
},
"otherfield": {
"type": "string",
"title": "Some other otherfield"
}
}
}
};
and change the resolver to:
function (names, data, cb) {
var schemas = new Object();
schemas["$.nextfields"] = typeSchemas[data.type];
cb(schemas);
}
from json-forms.
Thank you for your reply!
Ok, maybe I am stupid and can't transfer your suggestions to the code, but please have a look at:
https://jsfiddle.net/ajzmgkh4/
from json-forms.
The reason is that this schema is different to the previous one (it does not have a nextfields
property)
from json-forms.
Ok, the short answer is: Yes I am too stupid to transfer your example. :)
Just for documentation purpose: https://jsfiddle.net/ajzmgkh4/1/
Thank you for your help!
from json-forms.
:)
from json-forms.
https://jsfiddle.net/hxh_robb/xk663z01/
I've added a new feature called "appendedProperties" to meet this requirement without using schemaResovler. Since schemaResovler is a kind of behavior for "dynamic" additional properties rendering(What I mean "dynamic" is that the additional properties definition is a CRUD record, the schemaResovler might made an ajax call for that and generate a returned schema). "appendedProperties" is much more suit for that if one just need a "fixed" additional properties definition.
from json-forms.
Related Issues (20)
- Support for file type field HOT 2
- Request : validation & skipping /Logic
- Request : Option for 1 by 1 Input showing
- How can I add an `id` or `class` to an input?
- Unnecessary eval prevents execution in CSP environment
- Problem with an optional array and minItems
- recursive $ref iteration HOT 2
- "pretty" enum display strings aren't working in bootstrap
- Nested json rendering
- CleanData after onChange between oneOf HOT 4
- Is there a way to close off sections of the generated form? HOT 1
- getData() fails for array nested in oneOf
- Validation failure of enum value HOT 1
- Events support HOT 1
- Nulls are returned instead of empty strings HOT 1
- Can I generate data in JSON file not Javascript
- Multiple dependency input function HOT 1
- Style issue with the checkbox HOT 4
- Is it possible to hide Id on the form HOT 1
- Generate form with collapsible pannel HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-forms.