react icon indicating copy to clipboard operation
react copied to clipboard

[BUG] The data grid component doesn't save submission data of the first row

Open namti opened this issue 4 years ago • 10 comments

Environment

Please provide as many details as you can:

  • Hosting type
    • [ ] Form.io
    • [ x ] Local deployment
      • Version:
  • Formio.js version: 4.3.0
  • Frontend framework: ReactJS
  • Browser: Chrome
  • Browser version: Version 89.0.4389.114 (Official Build) (x86_64)

Steps to Reproduce #

  1. On the form builder, create a data grid component, add components to the row.

  2. Go to form view, fill in data for the first row and add more rows.
    image

  3. Check the data json in react dev tool, the first item is an empty array which should not be. image

Expected behavior

Save all data

Observed behavior

At the moment, this problem only can be fixed by editing the component on the form builder manually (not by code). Here is the steps to reproduce:

  1. Edit a form
  2. Add a data grid component
  3. Edit it
  4. Switch to "Data" tab
  5. Click on "Add another" to add one
  6. Remove the first one. Save it
  7. Fill in data on the form view. Check the react dev toll, data appeared. image

namti avatar May 13 '21 03:05 namti

I have this bug to... here is a video of the issue: https://youtu.be/tkCQCksowk4

HCMF avatar May 13 '21 04:05 HCMF

@namti @HCMF

What versions of formio.js are you running on?

wag110894 avatar May 14 '21 19:05 wag110894

I am also using 4.3.0

HCMF avatar May 17 '21 00:05 HCMF

This formio.js is rather old. Can you try upgrading? The latest stable version is 4.13.1.

wag110894 avatar May 17 '21 14:05 wag110894

As this is the React version, is it possible to update just the core formio.js?

HCMF avatar May 17 '21 21:05 HCMF

I have spotted the bug.

The first row which is generated by default always returns an array with object keys and values in it. image When setState in react, the illegal array is ignored and it is fell back to an empty array.

I have tried to upgrade to 5.0.0-rc.2, unfortunately the bug is still there.

namti avatar May 18 '21 00:05 namti

@namti, We welcome a pull request if you can provide a fix for the issue, then we can pull it in.

wag110894 avatar May 18 '21 14:05 wag110894

@namti great that you found the issue! Did you commit the fix? If you do I will buy you dinner! 😋

HCMF avatar May 22 '23 19:05 HCMF

I am also having trouble with this bug. Was it ever resolved?

AlpineM avatar Oct 11 '23 18:10 AlpineM

We are not able to reproduce this in the latest versions. Are you still having this issue in the latest versions?

daneformio avatar Mar 27 '24 13:03 daneformio

Thank you for your contribution. As this issue has been inactive for over 90 days, I will close it for now. If you wish to reopen the issue, please respond, and we can resume the triage process.

lane-formio avatar Jun 26 '24 13:06 lane-formio