@@ -110,18 +110,19 @@ export class FancytreeAdapter {
110110 return requestNodeToFancytreeNode ( requestNode . children [ Object . keys ( requestNode . children ) [ 0 ] ] ) ;
111111 }
112112
113- var key = "" + jQuery . ui . fancytree . _nextNodeKey ++ ;
113+ var refPath = requestNode . path . replace ( '\/' , '/' ) . replace ( '//' , '/' ) ;
114+ var key = this . pathKeyMap [ refPath ] || "" + jQuery . ui . fancytree . _nextNodeKey ++ ;
114115 var fancytreeNode = {
115116 title : requestNode . label ,
116117 key : key ,
117118 children : [ ] ,
118119 actions : { } ,
119- refPath : requestNode . path . replace ( '\/' , '/' ) . replace ( '//' , '/' ) ,
120+ refPath : refPath ,
120121 type : requestNode . payload_type ,
121122 unselectable : true
122123 } ;
123124
124- this . pathKeyMap [ fancytreeNode . refPath ] = key ;
125+ this . pathKeyMap [ refPath ] = key ;
125126
126127 if ( requestNode . descriptors . hasOwnProperty ( 'icon' ) ) {
127128 fancytreeNode . icon = requestNode . descriptors . icon ;
@@ -311,7 +312,20 @@ export class FancytreeAdapter {
311312
312313 var showPath = ( path ) => {
313314 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+ } ) ;
315329 }
316330
317331 this . tree . loadKeyPath ( generateKeyPath ( path ) , function ( node , status ) {
0 commit comments