@@ -133,14 +133,29 @@ export default class ModelManager {
133133
134134 isCollapsed ( viewName , viewIndex ) {
135135 const key = `${ viewName } ::${ viewIndex } ` ;
136+ if ( ! ( key in this . collapseState ) ) {
137+ // default to collapsed state
138+ // deferred setting of the collapsed state
139+ this . setCollapsed ( viewName , viewIndex , true ) ;
140+ }
136141 return this . collapseState [ key ] ;
137142 }
138143
139144 // --------
140145
141146 toggleCollapse ( viewName , viewIndex ) {
142147 const key = `${ viewName } ::${ viewIndex } ` ;
143- this . collapseState [ key ] = ! this . collapseState [ key ] ;
148+ this . collapseState = assignObjKey (
149+ this . collapseState ,
150+ key ,
151+ ! this . collapseState [ key ]
152+ ) ;
153+ }
154+
155+ // --------
156+ setCollapsed ( viewName , viewIndex , state ) {
157+ const key = `${ viewName } ::${ viewIndex } ` ;
158+ this . collapseState = assignObjKey ( this . collapseState , key , state ) ;
144159 }
145160
146161 // --------
@@ -153,6 +168,8 @@ export default class ModelManager {
153168 viewList . push ( { name, id : this . getNextViewId ( ) } ) ;
154169 this . data = assignObjKey ( this . data , viewName , viewList ) ;
155170 this . activateView ( viewName , index ) ;
171+ // expand menu if not already expanded
172+ this . setCollapsed ( viewName , 0 , false ) ;
156173 // generate data model for new view (...using a get method with side-effects...)
157174 this . getPropertyList ( ) ;
158175 this . runHooks ( ) ;
0 commit comments