@@ -129,6 +129,10 @@ export class FancytreeAdapter {
129
129
fancytreeNode . icon = requestNode . descriptors . icon ;
130
130
}
131
131
132
+ if ( requestNode . descriptors . hasOwnProperty ( 'position' ) ) {
133
+ fancytreeNode . position = requestNode . descriptors . position ;
134
+ }
135
+
132
136
for ( let actionName in actions ) {
133
137
var action = actions [ actionName ] ;
134
138
var url = parseUrl ( action . url , requestNode ) ;
@@ -226,11 +230,11 @@ export class FancytreeAdapter {
226
230
227
231
if ( this . sortableBy ) {
228
232
fancytreeOptions . sortChildren = ( a , b ) => {
229
- var firstItem = a . descriptors [ this . sortableBy ] ;
230
- var secondtItem = b . descriptors [ this . sortableBy ] ;
231
- if ( firstItem == secondtItem ) {
233
+ var current = a [ this . sortableBy ] ;
234
+ var next = b [ this . sortableBy ] ;
235
+ if ( current == next ) {
232
236
return 0 ;
233
- } else if ( firstItem < secondtItem ) {
237
+ } else if ( current < next ) {
234
238
return 1 ;
235
239
} else {
236
240
return - 1 ;
@@ -269,16 +273,15 @@ export class FancytreeAdapter {
269
273
parentNode . addChildren ( requestNodeToFancytreeNode ( responseData ) ) ;
270
274
} ;
271
275
let onError = ( jqxhr , textStatus , errorThrown ) => {
272
- console . error ( errorThrown ) ;
273
-
274
276
node . _error = { message : 'Failed to move the node.' , details : errorThrown } ;
275
277
node . renderStatus ( ) ;
278
+ console . error ( errorThrown ) ;
276
279
277
280
setTimeout ( function ( ) {
278
281
node . _error = null ;
279
282
node . renderStatus ( ) ;
280
283
} , 1000 ) ;
281
- }
284
+ } ;
282
285
this . requestData . move ( dropNodePath , targetPath ) . done ( ( responseData ) => {
283
286
if ( this . dndOptions . reorder ) {
284
287
this . requestData . reorder ( parenPath , dropedAtPath , targetPath , data . hitMode ) . done ( ( responseData ) => {
0 commit comments