Skip to content

Datagrid's default row doesn't include hidden components until interacted with #6253

@baronunread

Description

@baronunread

Describe the bug
A datagrid that has hidden components doesn't include the default value for those hidden fields

Version/Branch
@formio/js: 4.17.5

To Reproduce
This happens on 4.17.5 but also on https://formio.github.io/formio.js
You can use this basic JSON panel example to test out this problem:

{
  "label": "Panel",
  "breadcrumbClickable": true,
  "collapsible": false,
  "mask": false,
  "tableView": false,
  "alwaysEnabled": false,
  "type": "panel",
  "input": false,
  "components": [
    {
      "label": "Datagrid containing hidden fields",
      "reorder": false,
      "addAnotherPosition": "bottom",
      "layoutFixed": false,
      "enableRowGroups": false,
      "initEmpty": false,
      "tableView": false,
      "defaultValue": [
        {
          "hidden_textfield_in_datagrid": "value 2"
        }
      ],
      "customDefaultValue": "value = [{}]",
      "validateWhenHidden": false,
      "key": "datagrid",
      "type": "datagrid",
      "input": true,
      "components": [
        {
          "label": "Hidden textfield that must not lose its value",
          "applyMaskOn": "change",
          "hidden": true,
          "disabled": true,
          "tableView": true,
          "defaultValue": "Hidden value that should be available",
          "clearOnHide": false,
          "validate": {
            "required": true
          },
          "validateWhenHidden": false,
          "key": "hidden_textfield_in_datagrid",
          "type": "textfield",
          "input": true
        },
        {
          "label": "Visible Text Field",
          "applyMaskOn": "change",
          "tableView": true,
          "defaultValue": "Visible value",
          "validateWhenHidden": false,
          "key": "visible_text_field",
          "type": "textfield",
          "input": true
        }
      ]
    }
  ],
  "key": "panel",
  "collapsed": false,
  "reorder": false
}

Expected behavior
The datagrid includes the hidden values to begin with

Screenshots
Before interacting:

Image

After interacting:

Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions