[Bug] Repeatable field - reordering stops fields from working
See original GitHub issueBug 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:
- Created a year ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 !
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