I have code something like this
const Jschema = {
"type": "object",
"title": "Create Form",
"required": [
"level1",
"level2"
],
"properties": {
"level1": {
"type": "string",
"title": "Level 1",
"default": ""
},
"level2": {
"type": "array",
"items": {
"enum": [
"no position"
],
"type": "string"
},
"title": "Level 2",
"uniqueItems": true
},
},
"description": "Create Form"
}
const uiSchema = {
"ui:order": [
"level1",
"level2"
],
"level1": {
"ui:title": "Rank Level 1",
"ui:widget": "dropdown",
"ui:placeholder": "Please select rank level 1"
},
"level2": {
"ui:title": "Rank Level 2",
"ui:widget": "checkboxes",
"ui:placeholder": "Please select rank level 2"
}
}
const dropDownList = {
level1: {
url: '/v2/level1_rank',
name: 'level1',
accessorName: 'level1_name',
accessorValue: 'level1_value'
}
}
then will be generate on
render((
<Form schema={schema}
uiSchema={uiSchema}
formData={formData} />
), document.getElementById("app"));
then I have some logic like this, the level1 (select dropdown) will be show position of board (CEO, CFO, CMO and CTO) if we choose CFO level2 (checkboxes) will change to be (Accounting Manager, Finance Manager, Fraud Manager), if we choose CTO level2 will change to be (IT Manager, Infra Manager etc). let say I have backend and the backend was generate to state. I just get the state and need update the "items:" on level2 checkboxes.
So my question is how to change the "items:" on level2 by dynamically when I choose the level1 In my case, I want to select CFO, the the level2 checkbox will show three of position (Accounting Manager, Finance Manager, Fraud Manager etc) in CFO department, then I choose Accounting Manager and Fraud Manager only.
Thank you