@@ -110,18 +110,19 @@ export class FancytreeAdapter {
110
110
return requestNodeToFancytreeNode ( requestNode . children [ Object . keys ( requestNode . children ) [ 0 ] ] ) ;
111
111
}
112
112
113
- var key = "" + jQuery . ui . fancytree . _nextNodeKey ++ ;
113
+ var refPath = requestNode . path . replace ( '\/' , '/' ) . replace ( '//' , '/' ) ;
114
+ var key = this . pathKeyMap [ refPath ] || "" + jQuery . ui . fancytree . _nextNodeKey ++ ;
114
115
var fancytreeNode = {
115
116
title : requestNode . label ,
116
117
key : key ,
117
118
children : [ ] ,
118
119
actions : { } ,
119
- refPath : requestNode . path . replace ( '\/' , '/' ) . replace ( '//' , '/' ) ,
120
+ refPath : refPath ,
120
121
type : requestNode . payload_type ,
121
122
unselectable : true
122
123
} ;
123
124
124
- this . pathKeyMap [ fancytreeNode . refPath ] = key ;
125
+ this . pathKeyMap [ refPath ] = key ;
125
126
126
127
if ( requestNode . descriptors . hasOwnProperty ( 'icon' ) ) {
127
128
fancytreeNode . icon = requestNode . descriptors . icon ;
@@ -311,7 +312,20 @@ export class FancytreeAdapter {
311
312
312
313
var showPath = ( path ) => {
313
314
if ( ! this . pathKeyMap . hasOwnProperty ( path ) ) {
314
- return ;
315
+ var parts = path . split ( '/' ) ;
316
+
317
+ while ( ! this . pathKeyMap . hasOwnProperty ( parts . join ( '/' ) ) && parts . pop ( ) ) ;
318
+
319
+ if ( parts . length === 0 ) {
320
+ return ;
321
+ }
322
+
323
+ var loadedPath = parts . join ( '/' ) ;
324
+ var pathsToLoad = path . substr ( loadedPath . length + 1 ) . split ( '/' ) ;
325
+
326
+ pathsToLoad . forEach ( ( pathToLoad ) => {
327
+ this . pathKeyMap [ loadedPath += '/' + pathToLoad ] = "" + jQuery . ui . fancytree . _nextNodeKey ++ ;
328
+ } ) ;
315
329
}
316
330
317
331
this . tree . loadKeyPath ( generateKeyPath ( path ) , function ( node , status ) {
0 commit comments