Hi Sabina,
Greetings from Syncfusion support.
Please find the response for your queries below,
Query – 1: “Parent access and injection”
Based on the shared information we could understand that your requirement is to access the parent Grid instance in the child Grid events. This can be achieved by defining the reference in the parent Grid and binding the root instance to the child Grid events as demonstrated in the below code snippet,
|
<template>
<div id="app">
<ejs-grid :dataSource="parentData" ref="grid" :childGrid="childGrid">
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import { GridPlugin, DetailRow } from "@syncfusion/ej2-vue-grids";
import { data, employeeData } from "./datasource.js";
Vue.use(GridPlugin);
export default {
data() {
return {
childGrid: {
dataSource: data,
dataBound: this.dataBound.bind(this),
queryString: "EmployeeID",
},
};
},
methods: {
dataBound: function () {
// Parent Grid instance is accessed in the child Grid’s dataBound event
var parentGridInst = this.$refs.grid.ej2Instances;
},
}
};
</script> |
We have prepared a sample based on this for your reference. You can find it below,
Query – 2: “another question is regarding process of setting up props and transferring its data from child to a parent component”
Based on the query we could understand that you are trying to pass props from to the child component template which is defined as a separate component. We would like to let you know that extending the template and setting props data in the child component and child template component is the way of achieving it.
As for the console error that you have mentioned while following this approach, it is a known issue from our end and we have already logged bug report for the same. This fix will be included in our 2020 Volume 4 Main release which is expected to be rolled out by the end of December 2020. Until then your patience is appreciated.
You can now track the current status of this request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
Query – 3: “When setting up custom template (child component) to a column template "template: tempFunc", there is no way to use "content" attribute to GridModel since the "content" does no accept template functions.”
Query – 4: “We can see attributes accessible/usable in a grids' GridModel for Vue here: https://ej2.syncfusion.com/vue/documentation/api/grid/gridModel/ but there is no VueGridModel specific type”
We are not able to clearly understand the problem you are referring to with these queries and attached code screenshot. Are you facing issue on binding template to the child Grid when using the GridModel? Because in your query -2, you had mentioned you were able to bind template but facing error on passing props. So can you please elaborate on what issue you are facing here so that we can validate further and provide you the details.
Let us know if you have any concerns.
Regards,
Sujith R