This repository was archived by the owner on Sep 8, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ angular.module('ui.sortable', [])
97
97
}
98
98
return ;
99
99
}
100
-
100
+
101
101
if ( ! defaultOptions ) {
102
102
defaultOptions = angular . element . ui . sortable ( ) . options ;
103
103
}
@@ -195,6 +195,20 @@ angular.module('ui.sortable', [])
195
195
break ;
196
196
}
197
197
}
198
+ //If result is still null it means that the draggable (ng-repeat) item isn't a direct child of
199
+ //the element containing the ui.sortable directive. This may be required when using the ui.sortable
200
+ //directive with other directives that have isolated scopes. This will compare x.element[0]
201
+ //with the closest ancestorof element[0] that has the ui-sortable attribute to get the applicable
202
+ //element scope.
203
+ if ( ! result ) {
204
+ for ( i = 0 ; i < elementScopes . length ; i ++ ) {
205
+ x = elementScopes [ i ] ;
206
+ if ( x . element [ 0 ] === element [ 0 ] . closest ( '[ui-sortable]' ) ) {
207
+ result = x . scope ;
208
+ break ;
209
+ }
210
+ }
211
+ }
198
212
return result ;
199
213
}
200
214
@@ -459,7 +473,7 @@ angular.module('ui.sortable', [])
459
473
var sortableWidgetInstance = getSortableWidgetInstance ( element ) ;
460
474
if ( ! ! sortableWidgetInstance ) {
461
475
var optsDiff = patchUISortableOptions ( newVal , oldVal , sortableWidgetInstance ) ;
462
-
476
+
463
477
if ( optsDiff ) {
464
478
element . sortable ( 'option' , optsDiff ) ;
465
479
}
@@ -475,7 +489,7 @@ angular.module('ui.sortable', [])
475
489
} else {
476
490
$log . info ( 'ui.sortable: ngModel not provided!' , element ) ;
477
491
}
478
-
492
+
479
493
// Create sortable
480
494
element . sortable ( opts ) ;
481
495
}
You can’t perform that action at this time.
0 commit comments