在数据网格中使用 form.io 中的条件
Using conditionals in form.io within a datagrid
我刚开始弄乱 form.io,有点卡住了。我正在尝试在数据网格的每一行中创建一些条件。例如。如果选择等于“payIn”的单选按钮,则同一行中应出现另一个字段。我可以通过将数组编号分配给组件的 JSON 来静态地做到这一点,但这显然不能解决这个动态工作的问题(这只是用来测试逻辑,因为它总是指向第一行)。我怎样才能 do/use 使这个逻辑在数据网格中的每一行中独立工作?
{
"label": "Pay In Reason",
"widget": "choicesjs",
"hidden": true,
"tableView": true,
"data": {
"values": [
{
"label": "Employee",
"value": "employee"
},
{
"label": "Bank",
"value": "bank"
}
],
"json": "",
"url": "",
"resource": "",
"custom": ""
},
"selectThreshold": 0.3,
"key": "payInReason",
"conditional": {
"show": true,
"when": "dataGrid[0].payInOut",
"eq": "payIn"
},
"type": "select",
"indexeddb": {
"filter": {}
},
"input": true,
"placeholder": "",
"prefix": "",
"customClass": "",
"suffix": "",
"multiple": false,
"defaultValue": null,
"protected": false,
"unique": false,
"persistent": true,
"clearOnHide": true,
"refreshOn": "",
"redrawOn": "",
"modalEdit": false,
"labelPosition": "top",
"description": "",
"errorLabel": "",
"tooltip": "",
"hideLabel": false,
"tabindex": "",
"disabled": false,
"autofocus": false,
"dbIndex": false,
"customDefaultValue": "",
"calculateValue": "",
"calculateServer": false,
"attributes": {},
"validateOn": "change",
"validate": {
"required": false,
"custom": "",
"customPrivate": false,
"strictDateValidation": false,
"multiple": false,
"unique": false
},
"overlay": {
"style": "",
"left": "",
"top": "",
"width": "",
"height": ""
},
"allowCalculateOverride": false,
"encrypted": false,
"showCharCount": false,
"showWordCount": false,
"properties": {},
"allowMultipleMasks": false,
"clearOnRefresh": false,
"limit": 100,
"dataSrc": "values",
"valueProperty": "",
"lazyLoad": true,
"filter": "",
"searchEnabled": true,
"searchField": "",
"minSearch": 0,
"readOnlyValue": false,
"authenticate": false,
"template": "<span>{{ item.label }}</span>",
"selectFields": "",
"searchThreshold": 0.3,
"uniqueOptions": false,
"fuseOptions": {
"include": "score",
"threshold": 0.3
},
"customOptions": {},
"id": "eas39m"
}
感谢您的帮助!
类似这样的作品:show = (row.component === 'value')
我刚开始弄乱 form.io,有点卡住了。我正在尝试在数据网格的每一行中创建一些条件。例如。如果选择等于“payIn”的单选按钮,则同一行中应出现另一个字段。我可以通过将数组编号分配给组件的 JSON 来静态地做到这一点,但这显然不能解决这个动态工作的问题(这只是用来测试逻辑,因为它总是指向第一行)。我怎样才能 do/use 使这个逻辑在数据网格中的每一行中独立工作?
{
"label": "Pay In Reason",
"widget": "choicesjs",
"hidden": true,
"tableView": true,
"data": {
"values": [
{
"label": "Employee",
"value": "employee"
},
{
"label": "Bank",
"value": "bank"
}
],
"json": "",
"url": "",
"resource": "",
"custom": ""
},
"selectThreshold": 0.3,
"key": "payInReason",
"conditional": {
"show": true,
"when": "dataGrid[0].payInOut",
"eq": "payIn"
},
"type": "select",
"indexeddb": {
"filter": {}
},
"input": true,
"placeholder": "",
"prefix": "",
"customClass": "",
"suffix": "",
"multiple": false,
"defaultValue": null,
"protected": false,
"unique": false,
"persistent": true,
"clearOnHide": true,
"refreshOn": "",
"redrawOn": "",
"modalEdit": false,
"labelPosition": "top",
"description": "",
"errorLabel": "",
"tooltip": "",
"hideLabel": false,
"tabindex": "",
"disabled": false,
"autofocus": false,
"dbIndex": false,
"customDefaultValue": "",
"calculateValue": "",
"calculateServer": false,
"attributes": {},
"validateOn": "change",
"validate": {
"required": false,
"custom": "",
"customPrivate": false,
"strictDateValidation": false,
"multiple": false,
"unique": false
},
"overlay": {
"style": "",
"left": "",
"top": "",
"width": "",
"height": ""
},
"allowCalculateOverride": false,
"encrypted": false,
"showCharCount": false,
"showWordCount": false,
"properties": {},
"allowMultipleMasks": false,
"clearOnRefresh": false,
"limit": 100,
"dataSrc": "values",
"valueProperty": "",
"lazyLoad": true,
"filter": "",
"searchEnabled": true,
"searchField": "",
"minSearch": 0,
"readOnlyValue": false,
"authenticate": false,
"template": "<span>{{ item.label }}</span>",
"selectFields": "",
"searchThreshold": 0.3,
"uniqueOptions": false,
"fuseOptions": {
"include": "score",
"threshold": 0.3
},
"customOptions": {},
"id": "eas39m"
}
感谢您的帮助!
类似这样的作品:show = (row.component === 'value')