Skip to content

Commit 984c378

Browse files
authored
Merge pull request jbaysolutions#483 from jbaysolutions/pr/461
fix: wrong parent layout when GridItem is not the child of GridLayout
2 parents eba2559 + bcbf636 commit 984c378

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/components/GridItem.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
default: 'a, button'
198198
},
199199
},
200-
inject: ["eventBus"],
200+
inject: ["eventBus", "layout"],
201201
data: function () {
202202
return {
203203
cols: 1,
@@ -301,22 +301,22 @@
301301
}
302302
},
303303
mounted: function () {
304-
this.cols = this.$parent.colNum;
305-
this.rowHeight = this.$parent.rowHeight;
306-
this.containerWidth = this.$parent.width !== null ? this.$parent.width : 100;
307-
this.margin = this.$parent.margin !== undefined ? this.$parent.margin : [10, 10];
308-
this.maxRows = this.$parent.maxRows;
304+
this.cols = this.layout.colNum;
305+
this.rowHeight = this.layout.rowHeight;
306+
this.containerWidth = this.layout.width !== null ? this.layout.width : 100;
307+
this.margin = this.layout.margin !== undefined ? this.layout.margin : [10, 10];
308+
this.maxRows = this.layout.maxRows;
309309
if (this.isDraggable === null) {
310-
this.draggable = this.$parent.isDraggable;
310+
this.draggable = this.layout.isDraggable;
311311
} else {
312312
this.draggable = this.isDraggable;
313313
}
314314
if (this.isResizable === null) {
315-
this.resizable = this.$parent.isResizable;
315+
this.resizable = this.layout.isResizable;
316316
} else {
317317
this.resizable = this.isResizable;
318318
}
319-
this.useCssTransforms = this.$parent.useCssTransforms;
319+
this.useCssTransforms = this.layout.useCssTransforms;
320320
this.createStyle();
321321
},
322322
watch: {
@@ -417,7 +417,7 @@
417417
return navigator.userAgent.toLowerCase().indexOf("android") !== -1;
418418
},
419419
renderRtl() {
420-
return (this.$parent.isMirrored) ? !this.rtl : this.rtl;
420+
return (this.layout.isMirrored) ? !this.rtl : this.rtl;
421421
},
422422
resizableHandleClass() {
423423
if (this.renderRtl) {

src/components/GridLayout.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
name: "GridLayout",
3232
provide() {
3333
return {
34-
eventBus: null
34+
eventBus: null,
35+
layout: this
3536
}
3637
},
3738
components: {

0 commit comments

Comments
 (0)