Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SortableCollection doesn't allow to sort new items #18

Open
jdadeliom opened this issue Aug 3, 2023 · 1 comment
Open

SortableCollection doesn't allow to sort new items #18

jdadeliom opened this issue Aug 3, 2023 · 1 comment

Comments

@jdadeliom
Copy link
Contributor

The div of the new item isn't added at the same level of the other collection's items.

Video :

sortablecollection-doesnt-allow-to-sort-new-items.mov

The feature comes from :
lib/easy-fields-bundle/assets/js/form-type-collection-sortable.js:78

const newItemInsertionSelector = 
    isArrayCollection ?
         '.ea-form-collection-items' : '
         .ea-form-collection-items .accordion > .form-widget-compound' 

It seems to fix it by adding the data-row-id to the selector.
But as I haven't tested thoroughly it needs to be tested to prevent side effect.

const newItemInsertionSelector = 
    isArrayCollection ?
         '.ea-form-collection-items' : '
         .ea-form-collection-items .accordion > .form-widget-compound'  + (collection.dataset.rowId !== undefined && collection.dataset.rowId !== '' ? ' > # ' + collection.dataset.rowId : '');
@arnaud-ritti
Copy link
Contributor

for the index you have to change your entry_options like this .

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants