@@ -51,6 +51,7 @@ export interface NodeStoreConstructorOptions {
5151 selectFirstOnSingle : boolean ;
5252 validationMessages : ValidationMessage [ ] ;
5353 calculateInitialParents : boolean ;
54+ loadScenario : "all" | "partial" ;
5455 expandFirstLevel : boolean ;
5556 resetState : boolean ;
5657 rowObjectMxProperties : RowObjectMxProperties ;
@@ -94,6 +95,7 @@ export class NodeStore {
9495 private onSelect : ( ids ?: string [ ] ) => void ;
9596
9697 private selectionMode : SelectionMode ;
98+ private loadScenario : "all" | "partial" ;
9799 private dataResetOnContextChange : boolean ;
98100 private needToCalculateInitialParents : boolean ;
99101 private needToRestoreStateOnContextChange : boolean ;
@@ -111,6 +113,7 @@ export class NodeStore {
111113 validColumns,
112114 selectFirstOnSingle,
113115 calculateInitialParents,
116+ loadScenario,
114117 childLoader,
115118 convertMxObjectToRow,
116119 rowObjectMxProperties,
@@ -133,6 +136,7 @@ export class NodeStore {
133136 this . selectFirstOnSingle = selectFirstOnSingle ;
134137 this . needToRestoreSelectFirst = selectFirstOnSingle ;
135138 this . calculateInitialParents = calculateInitialParents ;
139+ this . loadScenario = loadScenario ;
136140 this . needToCalculateInitialParents = calculateInitialParents ;
137141 this . validationMessages = validationMessages ;
138142 this . rowObjectMxProperties = rowObjectMxProperties ;
@@ -219,7 +223,7 @@ export class NodeStore {
219223
220224 @action
221225 setRowObjects ( mxObjects : mendix . lib . MxObject [ ] , level ?: number , parent ?: string | null ) : void {
222- this . debug ( "store: setRowObjects" , mxObjects . length , level , this . resetState ) ;
226+ this . debug ( "store: setRowObjects" , mxObjects . length , level , this . resetState , this . calculateInitialParents ) ;
223227 let currentRows : RowObject [ ] = level === - 1 ? [ ] : [ ...this . rowObjects ] ;
224228 let initialState : TableState = { context : this . contextObject ?. getGuid ( ) || null , expanded : [ ] , selected : [ ] } ;
225229
@@ -285,6 +289,7 @@ export class NodeStore {
285289 const objIndex = currentRows . findIndex ( row => row . key === mxObject . getGuid ( ) ) ;
286290 if ( objIndex === - 1 ) {
287291 const treeParent = treeMapping [ mxObject . getGuid ( ) ] ;
292+ // console.log(treeMapping, treeParent);
288293 const parentObj = this . calculateInitialParents && treeParent ? treeParent : parent ;
289294 currentRows . push (
290295 new RowObject ( {
@@ -321,10 +326,10 @@ export class NodeStore {
321326 }
322327 } ) ;
323328 this . rowObjects = currentRows ;
324- if ( this . calculateInitialParents ) {
329+ if ( this . calculateInitialParents && this . loadScenario === "partial" ) {
325330 this . disableCalculateInitial ( ) ;
326331 }
327- if ( this . resetState ) {
332+ if ( this . resetState && this . loadScenario === "partial" ) {
328333 this . disableResetState ( ) ;
329334 }
330335 if ( this . selectFirstOnSingle ) {
@@ -428,7 +433,7 @@ export class NodeStore {
428433 subscribe ( {
429434 callback : ( ) => {
430435 this . debug ( `store: subcription fired context ${ guid } ` ) ;
431- this . clearSubscriptions ( "store context subscription" ) ;
436+ this . resetSubscriptions ( "store context subscription" ) ;
432437 this . reset ( ) ;
433438 } ,
434439 guid
0 commit comments