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

Skip to content

Commit eef37e5

Browse files
authored
Merge pull request #3061 from adumesny/master
added `GridStack.updateCB(w)`
2 parents 5c99d65 + cae3467 commit eef37e5

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

doc/CHANGES.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ Change log
55
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
66
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
77

8-
- [12.1.2-dev (2024-05-07)](#1212-dev-2024-05-07)
8+
- [12.2.0 (2025-05-27)](#1220-2025-05-27)
9+
- [12.1.2 (2024-05-07)](#1212-2024-05-07)
910
- [12.1.1 (2024-04-28)](#1211-2024-04-28)
1011
- [12.1.0 (2024-04-23)](#1210-2024-04-23)
1112
- [12.0.0 (2025-04-12)](#1200-2025-04-12)
@@ -127,7 +128,10 @@ Change log
127128

128129
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
129130

130-
## 12.1.2-dev (2024-05-07)
131+
## 12.2.0 (2025-05-27)
132+
* feat: [#3061](https://github.com/gridstack/gridstack.js/pull/3061) added `GridStack.updateCB(w)` that gets called after a widget has been updated (eg: load() after initial layout) instead of created
133+
134+
## 12.1.2 (2024-05-07)
131135
* fix [#3043](https://github.com/gridstack/gridstack.js/issues/3043) fix `opts.animate` again
132136
* fix [#3048](https://github.com/gridstack/gridstack.js/pull/3048) nested grid resizeToContentCBCheck() fix
133137

src/gridstack.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ export class GridStack {
187187
*/
188188
public static renderCB?: RenderFcn = (el: HTMLElement, w: GridStackNode) => { if (el && w?.content) el.textContent = w.content; };
189189

190+
/** called after a widget has been updated (eg: load() into an existing list of children) so application can do extra work */
191+
public static updateCB?: (w: GridStackNode) => void;
192+
190193
/** callback to use for resizeToContent instead of the built in one */
191194
public static resizeToContentCB?: ResizeToContentFcn;
192195
/** parent class for sizing content. defaults to '.grid-stack-item-content' */
@@ -1383,6 +1386,7 @@ export class GridStack {
13831386
if (ddChanged) {
13841387
this.prepareDragDrop(n.el);
13851388
}
1389+
GridStack.updateCB(n); // call user callback so they know widget got updated
13861390
});
13871391

13881392
return this;

0 commit comments

Comments
 (0)