Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 018e80e

Browse files
authored
Merge pull request #3062 from adumesny/master
more GridStack.updateCB
2 parents eef37e5 + 860d255 commit 018e80e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

angular/projects/lib/src/lib/gridstack.component.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ export class GridstackComponent implements OnInit, AfterContentInit, OnDestroy {
126126
if (!GridStack.saveCB) {
127127
GridStack.saveCB = gsSaveAdditionalNgInfo;
128128
}
129+
if (!GridStack.updateCB) {
130+
GridStack.updateCB = gsUpdateNgComponents;
131+
}
129132
this.el._gridComp = this;
130133
}
131134

@@ -315,3 +318,12 @@ export function gsSaveAdditionalNgInfo(n: NgGridStackNode, w: NgGridStackWidget)
315318
//.... save any custom data
316319
}
317320
}
321+
322+
/**
323+
* track when widgeta re updated (rather than created) to make sure we de-serialize them as well
324+
*/
325+
export function gsUpdateNgComponents(n: NgGridStackNode) {
326+
const w: NgGridStackWidget = n;
327+
const gridItem = (n.el as GridItemCompHTMLElement)?._gridItemComp;
328+
if (gridItem?.childWidget && w.input) gridItem.childWidget.deserialize(w);
329+
}

0 commit comments

Comments
 (0)