MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / onShow

Method onShow

angular/projects/demo/src/app/app.component.ts:133–160  ·  view source on GitHub ↗
(val: number)

Source from the content-addressed store, hash-verified

131 }
132
133 public onShow(val: number) {
134 this.show = val;
135
136 // set globally our method to create the right widget type
137 if (val < 3) GridStack.addRemoveCB = undefined;
138 else GridStack.addRemoveCB = gsCreateNgComponents;
139
140 // let the switch take affect then load the starting values (since we sometimes save())
141 setTimeout(() => {
142 let data;
143 switch(val) {
144 case 0: data = this.case0Comp?.items; break;
145 case 1: data = this.case1Comp?.items; break;
146 case 2: data = this.case2Comp?.items; break;
147 case 3: data = this.gridComp?.grid?.save(true, true); break;
148 case 4: data = this.items; break;
149 case 5: data = this.gridOptionsFull; break;
150 case 6: data = this.nestedGridOptions;
151 GridStack.setupDragIn('.sidebar-item', undefined, this.sidebarContent6);
152 break;
153 case 7: data = this.twoGridOpt1;
154 GridStack.setupDragIn('.sidebar-item', undefined, this.sidebarContent7);
155 break;
156 }
157 if (this.origTextEl) this.origTextEl.nativeElement.value = JSON.stringify(data, null, ' ');
158 });
159 if (this.textEl) this.textEl.nativeElement.value = '';
160 }
161
162 /** called whenever items change size/position/etc.. */
163 public onChange(data: nodesCB) {

Callers 1

ngOnInitMethod · 0.95

Calls 2

setupDragInMethod · 0.80
saveMethod · 0.45

Tested by

no test coverage detected