magento2: Dynamic Rows - deleteValue/deleteProperty not used on deleting records

Magento Docs state the following for dynamic rows config

deleteProperty The property added to a record data object when the record is deleted. Applied if the deleteValue option is enabled.

deleteValue Adds the deleteProperty property in the data object for the deleted record.

If I create a dynamic rows instance and set deleteValue to true and deleteProperty to “delete”. When I delete a record, and save the record set, I would expect the controller to receive a data set including the deleted row, but with the deleted row marked with “delete” so the controller can easily see a deleted record and handle the removal.

I am not seeing this behaviour.

Preconditions (*)

  1. 2.4-develop

Steps to reproduce (*)

  1. Install test module (attached to issue)
  2. Go to the following page https://<host>/admin/testdynamicrows/test/index/entity_id/1 image
  3. Click save without modifying data. The data passed to the save handler is displayed image
  4. Go back to https://<host>/admin/testdynamicrows/test/index/entity_id/1
  5. Remove row from data set.
  6. Click save.

Expected result (*)

  1. Data passed to save controller includes both records, but the record that was deleted is marked as deleted due to deleteValue being set true.

Actual result (*)

  1. Only 1 record is passed to save controller. image

Proof of concept Module attached here. testdynamicrows.zip


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 2
  • Comments: 25 (14 by maintainers)

Most upvoted comments

Ok. The correct approach here is to push this back to whoever broke it and request that they reimplement their change, this time testing it properly.

Can’t quite believe what I’ve read here but explains why UI component implementation is so poorly done and hit and miss. Someone makes a change, doesn’t test it properly and it results in breaking documented functionality that others may rely on. And you’re joking about leaving it broken and just removing from the docs? Unprofessional! No wonder Magento is falling apart.

@gwharton . The issue is still reproducible on fresh 2.4-develop.

Steps to reproduce:

  1. Install test module testdynamicrows.zip
  2. Go to the following page https://<host>/admin/testdynamicrows/test/index/entity_id/1 Screenshot from 2021-01-29 13-09-06
  3. Click save without modifying data. The data passed to the save handler is displayed {"post_data":{"testdynamicrows":{"testdynamicrows":[{"entity_id":"1","data_field":"Data Field 1","initialize":"true","record_id":"0"},{"entity_id":"2","data_field":"Data Field 2","initialize":"true","record_id":"1"}]},"form_key":"mDiYNxe68AaH4t3S"}}
  4. Go back to https://<host>/admin/testdynamicrows/test/index/entity_id/1
  5. Remove row from data set.
  6. Click save.

Actual Result: ❌ Only 1 record is passed to save controller. {"post_data":{"testdynamicrows":{"testdynamicrows":[{"entity_id":"2","data_field":"Data Field 2","initialize":"true","record_id":"1"}]},"form_key":"mDiYNxe68AaH4t3S"}}

Note: 2021-01-29_13-13

If I run the test module on 2.1.18 (updated version of proof of concept module that works on 2.1.18 attached) then it works as expected. In this example, I have removed the second row and saved.

image

app.zip

It appears to have stopped working in 2.2.0, from this commit. https://github.com/magento/magento2/commit/d5f0dd2e5647c29f840efc1c03741b0e9b4f2c57