Skip to content

Commit 1163b89

Browse files
lopezvolivermaartenbreddels
authored andcommitted
feat: add on_layer_updated to GridLayout
1 parent e1567f9 commit 1163b89

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

solara/widgets/vue/gridlayout.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
:vertical-compact="true"
1212
:margin="[10, 10]"
1313
:use-css-transforms="true"
14+
@layout-updated="onLayoutUpdated"
1415
>
1516

1617
<grid-item v-for="item in grid_layout"
@@ -49,6 +50,9 @@ module.exports = {
4950
// this will cause bqplot to layout itself
5051
window.dispatchEvent(new Event('resize'));
5152
},
53+
onLayoutUpdated(layout) {
54+
this.layout_updated(layout);
55+
},
5256
import(deps) {
5357
return this.loadRequire().then(
5458
() => {

solara/widgets/widgets.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ class GridLayout(v.VuetifyTemplate):
5252
draggable = traitlets.CBool(True).tag(sync=True)
5353
resizable = traitlets.CBool(True).tag(sync=True)
5454
cdn = traitlets.Unicode(None, allow_none=True).tag(sync=True)
55+
on_layout_updated = traitlets.traitlets.Callable(None, allow_none=True)
56+
57+
def vue_layout_updated(self, *args):
58+
if self.on_layout_updated is not None:
59+
self.on_layout_updated(*args)
5560

5661
@traitlets.default("cdn")
5762
def _cdn(self):

0 commit comments

Comments
 (0)