Hi,
In my Vue 3 project, I am using the TreeGrid component with column template. In
development mode, this is working and I see the given template, but in production
(it is built using webpack 5) nothing is shown. The TreeGrid shows no data. There
is no error message in the console.
Please help me to fix this issue.
Thanks
NameColumn.vue:
<template>
<div>
<b>{{ data.name }}</b>
</div>
</template>
<script>
export default {
name: 'nameColumnTemplate',
data() {
return {
}
}
}
MyTreeGrid.vue:
<template>
<ejs-treegrid
ref="treegrid"
:dataSource="dataSource"
:columns='columns'>
</ejs-treegrid>
</template>
<script>
import myapp from "@/main.js"
import data from "./data.js"
import NameColumn from './NameColumn.vue'
export default {
data() {
let colVue = myapp.component("nameColumnTemplate", NameColumn);
let nameColumnTemplate = () => {return { template: colVue}}
let columns = [
{field: 'name', headerText: 'Name', textAlign: 'Left', width: 180, template: nameColumnTemplate },
]
return {
columns,
}
}
}
</script>
package.json:
{
…
"scripts": {
"serve": "webpack-dev-server --env development --config ./build/webpack.config.js",
"build": "webpack --env production --config ./build/webpack.config.js"
},
"dependencies": {
"@syncfusion/ej2-vue-buttons": " ^19.4.41 ",
"@syncfusion/ej2-vue-grids": " ^19.4.41 ",
"@syncfusion/ej2-vue-inputs": " ^19.4.41 ",
"@syncfusion/ej2-vue-popups": " ^19.4.41 ",
"@syncfusion/ej2-vue-treegrid": " ^19.4.41 ",
"core-js": "3.18.3",
"vue": "3.2.20",
"vue-class-component": "8.0.0-rc.1",
"vue-router": "4.0.12",
"vuex": "4.0.2"
},
…
}
|
module.exports = {
runtimeCompiler: true
} |
Hi,
I followed the documentation and I still have the same issue.
I want to emphasis that it is working for me while running in development mode, but I have this issue in production.
I am getting the following warning while building the application for production, may it related?
Hi,
Is there any update on this?
Thanks,
Hi, Thanks.
Does this warning cause the original issue I am facing during production?
The original issue: column template is not working with vue 3 in production. This issue is blocking.
Hi,
I can't run the project example you provided in production. I am getting the following error on console:
node: v14.15.1
npm: 6.14.8
Can you please help me with that? I already tried to remove node_modules directory and package-lock.json, and also cleaned my npm cache (npm cache clean --force).
Thanks,
Hi Pon,
I finally found the problem: the column template function must be decleared as a property (under data, or as computed etc).
To solve it:
Since my TreeGrid' columns were defined as a property, and I wanted to give a template to one of the columns, I had to return the column template function in data, and define the columns as computed property. This is what I did:
<template>
<div id="app">
<ejs-treegrid ref='grid' :dataSource="data" :columns="columns" height='100%' childMapping='subtasks'>
</ejs-treegrid>
</div>
</template>
<script>
import {createApp} from 'vue'
import NameColumn from './components/NameColumn.vue'
const app = createApp();
export default {
name: 'App',
data() {
let colVue = app.component("colTemplate", NameColumn);
return {
data: [{
taskID: 1,
taskName: 'Planning',
startDate: new Date('02/03/2017'),
endDate: new Date('02/07/2017'),
progress: 100,
duration: 5,
priority: 'Normal',
approved: false,
subtasks: [
{ taskID: 2, taskName: 'Plan timeline', startDate: new Date('02/03/2017'), endDate: new Date('02/07/2017'), duration: 5, progress: 100, priority: 'Normal', approved: false },
{ taskID: 3, taskName: 'Plan budget', startDate: new Date('02/03/2017'), endDate: new Date('02/07/2017'), duration: 5, progress: 100, approved: true },
{ taskID: 4, taskName: 'Allocate resources', startDate: new Date('02/03/2017'), endDate: new Date('02/07/2017'), duration: 5, progress: 100, priority: 'Critical', approved: false },
{ taskID: 5, taskName: 'Planning complete', startDate: new Date('02/07/2017'), endDate: new Date('02/07/2017'), duration: 0, progress: 0, priority: 'Low', approved: true }
]
},
],
colTemplate: () => { return { template: colVue }},
};
},
computed: {
columns() {
return [
{field: 'taskName', headerText: 'Task Name', template: this.colTemplate},
{field: 'priority', headerText: 'Priority'},
]
}
}
};
</script>
The problem is that when I didn't define the column template as a property (I didn't return it in data), everything worked for me in development mode, but the issue occured only in production.
Thank you for your help.
Hi Hung,
Sorry for the inconvenience,
We are unable to complete it as planned due to some internal complexities. However, we will prioritize and included it with our Volume 1 SP release which is scheduled on mid of May 2022.
We appreciate your patience until then.
Regards,
Gokul
Hi Hung,
Sorry for the inconvenience,
We are unable to complete it as planned. However, we will prioritize and included it with our upcoming weekly patch release which is scheduled on the 24th of May 2022 without fail.
We appreciate your patience until then.
Regards,
Gokul
Hi Tem,
Thanks for being patient.
We are glad to announce that our weekly patch release has been rolled out successfully. The reported bug “Template warning error while running application on development mode in Vue 3” has been fixed in the v20.1.56 release. As a result, we recommend you upgrade to the latest version of our Syncfusion package to avail of this fix.
Release Notes: https://ej2.syncfusion.com/vue/documentation/release-notes/20.1.56/?type=all#common
Kindly check the reported defect in the latest version and get back to us if you need any further assistance.
Regards,
Gokul