question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Repeatable field - reordering stops fields from working

See original GitHub issue

Bug report

What I did

In the demo, inside PetCrudController, I’ve made the owners() field show up/down arrows too, in order for an admin to be able to reorder its owners. So I just added reorder(true) on the owners field.

What I expected to happen

  • arrows to show
  • after you click the arrows, the fields to work

What happened

  • arrows do show
  • sometimes… after you click the arrows, the JS fields STOP WORKING

https://user-images.githubusercontent.com/1032474/166426676-8ec15ffa-d0a4-4085-961b-78faaa17fbaf.mp4

What I’ve already tried to fix it

Nothing yet… I expect the fields need to be re-initialized or something.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
gkamaratakcommented, May 3, 2022

Hello Cristian and Pedro,

I am writing here what else I have noticed.

Select2 , Browse , Datepicker and whatever other field needs initialization does not respond on the moved row. As far as I investigated when a row is moved it is cloned and then deleted the original one. Therefore it needs inititalization when created (That’s for the elements that needs libraries to work).

Tried textbox works fine. Tried the simple select and it loses the latest selected value when moved and returns to the value when the repeatable was loaded.

It is like when you change order you need to init all the fields of the row again. (I could do it too but there is no way i can know what kind of fields are inside the row after the cloning , to do it ) PLUS somehow after the clone i need to re-set the values to the fields. So before clone store everything after clone re-set them.

(Regarding the video) If you go deeper you will see that the value of the select2 on the moved row is the initial value when loaded and not the latest selected.

If I find anything else I will let you know. Thanks !

1reaction
pxpmcommented, May 3, 2022

Hello, just to let you guys know that the PR to pro is already submitted.

The issue was the fact that when we changed to arrayed names, we also changed the order/how repeatable elements are initialized and cloned on page. In the “order operation” we were directly cloning the repeatable container visible on page that already had the fields initialized, so when it was removed and re- added in the desired position, the fields that depend on javascript would stop working because they were never re-initialized.

Cheers

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript error when reordering in Post Object Repeater
We're seeing a repeated javascript error when we have multiple posts in a Post Object repeater field and a user tries to reposition...
Read more >
Web content repeatable fields cannot reordered in DXP 7.4
Go to Content & Data --> Web Content --> Structures and add a structure with a field (for example, text field) and set...
Read more >
Reorder Blocks - Salesforce Help
You can reorder blocks in joined reports. Reordering blocks affects the report's appearance but doesn't affect the data in the blocks.Required Editions an....
Read more >
Repeatable fields no longer work and impossible to remove
Hello, Some repeatable fields no longer work. The add button is visible but the fields no longer appear and the button clicks in...
Read more >
About Field Options - Formidable Forms
Field action icons · Move field: Re-order fields within your form. · More options: Click this icon to show more options. · Delete:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found