Skip to content

Failed to execute 'removeChild' The node to be removed is not a child of this node. #26

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

Closed
celsomtrindade opened this issue Mar 7, 2017 · 1 comment · Fixed by #28
Closed

Comments

@celsomtrindade
Copy link

At first I tought my error was similar to #23 but it's a bit different.

Basically, this happens when I try to use the put/pull method defined within the group params when working with nested sorting so I can move from one nested sorting list to another nested sorting list.

This is the error:

Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
at _sync (angular-legacy-sortable.js:118:46)
at a.onAdd (angular-legacy-sortable.js:172:33)

This is what my config looks like:

vm.list = [
    {id: 1, name: 'Name of item 1',
        gallery: [
            {id: 1, name: 'Name of image 1'},
            {id: 2, name: 'Name of image 2'},
            {id: 3, name: 'Name of image 3'}
        ]
    },
    {id: 2, name: 'Name of item 2', 
        gallery: [
            {id: 1, name: 'Name of image 1'},
            {id: 2, name: 'Name of image 2'},
        ]
    },
    {id: 3, name: 'Name of item 3', gallery: []}
];

And use it like this:

<ul ng-sortable>
    <li ng-repeat="item in vm.list track by item.id">
        <p>{{item.name}}</p>
        <ul ng-sortable="{group: {name:'child', put: true, pull:true} }">
            <li ng-repeat="gallery in item.gallery track by gallery.id">
                <p>{{gallery.nome}}</p>
            </li>
        </ul> 
    </li>
</ul>

I also tried to define the nested sortable item as follow:

<ul ng-sortable="{group: {name:'child{{item.id}}', put: true, pull:true} }">

//or
<ul ng-sortable="{group: {name:'child{{item.id}}', put: 'child{{item.id}}', pull:true} }">

Both give me the same end result, wich is the error and then stop working 100%.

@archangellcc
Copy link

I meet the same problem.
commenting some code in following, it works.
But doing so may lead to some errors, hoping someone can fix it.

// if (evt.clone) {
// 	removed = angular.copy(removed);
// 	prevItems.splice(Sortable.utils.index(evt.clone, sortable.options.draggable), 0, prevItems.splice(oldIndex, 1)[0]);
// 	console.log(evt.from);
//     evt.from.removeChild(evt.clone);
// }
// else {
	prevItems.splice(oldIndex, 1);
// }

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