Skip to content

Using the accept function is not so easy (placeholderIndex value is missing from the parameters). #390

@DumboJet

Description

@DumboJet

I have a list of dragables and some of them are disabled and I allow no drop on them.
I am using the accept function like so:

        accept: function (sourceItemHandleScope, destSortableScope, destItemScope) {
            var ix = destItemScope && destItemScope.index && destItemScope.index(),
                curr = $scope.items[ix];

            if (curr && curr.isSeparator) return false;
            return true;
        },

The issue is that, the ix and curr do not help me understand if the drop placeholder will be placed before or after the curr element. And it appears that it can be either of those.

Am I missing something?
Is there a way to find the items between which the drop placeholder will be placed?
I haven't managed to achieve this in my case.

UPDATE:

I think this is what is missing:

image

The placeholderIndex should be inserted in target or the sortable scope.
Do you accept PRs for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions