@@ -244,31 +244,34 @@ export class FancytreeAdapter {
244
244
var dropNodePath = data . otherNode . data . refPath ;
245
245
var targetPath = targetParentKeyPath + '/' + dropNodePath . substr ( 1 + dropNodePath . lastIndexOf ( '/' ) ) ;
246
246
247
- var oldIcon = data . otherNode . icon ;
248
247
data . otherNode . icon = 'fa fa-spinner fa-spin' ;
249
248
data . otherNode . renderTitle ( ) ;
250
- this . requestData . move ( dropNodePath , targetPath )
251
- . done ( function ( responseData ) {
252
- data . otherNode . remove ( ) ;
253
-
254
- if ( 'over' != data . hitMode ) {
255
- node = node . parent ;
256
- }
257
-
258
- node . addChildren ( requestNodeToFancytreeNode ( responseData ) ) ;
259
- } )
260
- . fail ( function ( jqxhr , textStatus , errorThrown ) {
261
- console . error ( errorThrown ) ;
262
-
263
- node . _error = { message : 'Failed to move the node.' , details : errorThrown } ;
249
+ var moveNodeInTree = function ( data , node , responseData ) {
250
+ data . otherNode . remove ( ) ;
251
+ if ( 'over' != data . hitMode ) {
252
+ node = node . parent ;
253
+ }
254
+ node . addChildren ( requestNodeToFancytreeNode ( responseData ) ) ;
255
+ } ;
256
+ _this . requestData . move ( dropNodePath , targetPath ) . done ( function ( responseData ) {
257
+ if ( _this . dndOptions . reorder ) {
258
+ _this . requestData . reorder ( targetParentKeyPath , targetPath , dropNodePath , data . hitMode ) . done ( function ( responseData ) {
259
+ moveNodeInTree ( data , node , responseData ) ;
260
+ } ) ;
261
+ } else {
262
+ moveNodeInTree ( data , node , responseData ) ;
263
+ }
264
+ } ) . fail ( function ( jqxhr , textStatus , errorThrown ) {
265
+ console . error ( errorThrown ) ;
266
+
267
+ node . _error = { message : 'Failed to move the node.' , details : errorThrown } ;
268
+ node . renderStatus ( ) ;
269
+
270
+ setTimeout ( function ( ) {
271
+ node . _error = null ;
264
272
node . renderStatus ( ) ;
265
-
266
- setTimeout ( function ( ) {
267
- node . _error = null ;
268
- node . renderStatus ( ) ;
269
- } , 1000 ) ;
270
- } )
271
- ;
273
+ } , 1000 ) ;
274
+ } ) ;
272
275
}
273
276
} ;
274
277
}
0 commit comments