cms icon indicating copy to clipboard operation
cms copied to clipboard

[5.x]: Table Fields with Static Row option don't update their content when rows are changed

Open MoritzLost opened this issue 10 months ago • 2 comments

What happened?

Description

We use a Table Field with the Static Rows option and a Row heading column to allow users to enter social media links in a simple and concise interface, without having to create too many fields manually:

Image

However, we have noticed that it's nearly impossible to change the definition of the table fields once some content has been entered, because existing contents are not updated when the table field changes.

Steps to reproduce

  1. Create a table field and configure it as seen in the screenshot above.
  2. Add it to an entry type and create some entries. Fill all rows with content.
  3. Change the order of two rows. The values in all existing entries won't match their heading any more.
  4. Delete a row, or add a row and move it between the existing rows. In either case, existing entries will again not match their heading any more.

Expected behavior

When the Static Rows option is used, changes to the structure of the table field should be reflected in existing contents. In particular if it's used in combination with a Row heading column.

Actual behavior

Basically, the only modification to a table field using those options is to add rows at the bottom. You can't re-arrange, delete or add rows (above existing rows) without screwing up existing contents.

Craft CMS version

5.6.11

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

No response

MoritzLost avatar Apr 15 '25 12:04 MoritzLost

Sorry for the delay, but we finally got this fixed for the Craft 4.17 and 5.9.

After updating, you will need to resave your Table field so the default rows get UUIDs assigned to them, then resave any elements that use that field (e.g. with resave/entries --with-fields=myTableField).

brandonkelly avatar Oct 20 '25 17:10 brandonkelly

@brandonkelly Thanks, Brandon!

MoritzLost avatar Oct 21 '25 09:10 MoritzLost