Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Allow ui-sortable to work on deep items #524

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,12 @@ angular.module('ui.sortable', [])
// we can't just do ui.item.index() because there it might have siblings
// which are not items
function getItemIndex(item) {
return item.parent()
.find(opts['ui-model-items'])
var par = item.parent();
while (!par.attr('ui-sortable')) {
par = par.parent();
}
return par
.find(opts['items'])
.index(item);
}

Expand Down