ninsuo / symfony-collection

[NOT MAINTAINED] A jQuery plugin that manages adding, deleting and moving elements from a Symfony form collection
https://symfony-collection.fuz.org/
MIT License
444 stars 88 forks source link

Elements of nested collections are in wrong order #163

Closed LinkingYou closed 4 years ago

LinkingYou commented 4 years ago

We have a form with nested collections ...it looks like this:

image

After submitting the form, we have a problem that the elments of nested collections are in wrong order (elements from one parent moved to another parent).

I looked for the markup of the corresponding fields generate by the javascript from prototypes:

attribut[valueJson][portForwardings][0][allowedNetworks][0][network]
attribut[valueJson][portForwardings][1][allowedNetworks][1][network]
attribut[valueJson][portForwardings][2][allowedNetworks][2][network]
attribut[valueJson][portForwardings][0][allowedNetworks][0][network]

I think, this is the problem. In my opinion it has to look like this:

attribut[valueJson][portForwardings][0][allowedNetworks][0][network]
attribut[valueJson][portForwardings][0][allowedNetworks][1][network]
attribut[valueJson][portForwardings][0][allowedNetworks][2][network]
attribut[valueJson][portForwardings][1][allowedNetworks][0][network]

image

If you need more information on debugging please contact me.

LinkingYou commented 4 years ago

Hello ninsuo,

My problem is a duplicate from https://github.com/ninsuo/symfony-collection/issues/84, and the suggestion to use a different prototype_name for each collection helped. It works fine now :-)

Best wishes Franky