TreeGrid – issue with column template in production with vue 3

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"

},

}



17 Replies 1 reply marked as answer

PS Pon Selva Jeganathan Syncfusion Team January 18, 2022 12:19 PM UTC

Hi Liraz ,  
 
Thanks for contacting syncfusion forum.  
 
Query : issue with column template 

Before using the template in the Vue application, we need to enable the runtime compiler. Create the Vue.config.js file in the root folder if it doesn’t exist and add the following code.  
  
  
module.exports = {  
runtimeCompiler: true  
  }  

For your reference we have prepared a sample of column Template in Vue 3. Please refer to the below sample  

Please refer the below documentation for more information.  



If you still face the issue, please replicate the issue with our above attached sample or share any issue reproducible sample that would be helpful for us to validate the application.  
 
Regards,  
Pon selva   
 



LI Liraz January 18, 2022 04:04 PM UTC

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?





PS Pon Selva Jeganathan Syncfusion Team January 20, 2022 03:43 AM UTC

Hi Liraz, 
 
we are able to reproduce the issue at our end. We have forwarded this request to our dependent component team to further validation and will update you with further details on or before 21st January 2022.  
 
Until then we value your patience.   
 
Regards,   
Pon selva    
 



LI Liraz January 25, 2022 05:50 PM UTC

Hi,

Is there any update on this?

Thanks,



PS Pon Selva Jeganathan Syncfusion Team January 26, 2022 02:27 PM UTC

Hi Liraz, 
  
Sorry for the inconvenience caused. 
  
Currently we are validating your query with high priority and will update you the further information on or before January 31, 2022. 
 
Until then, we appreciate your patience. 
  
Regards, 
Pon selva 



PS Pon Selva Jeganathan Syncfusion Team January 28, 2022 12:37 PM UTC

Hi Liraz,   
 
Thanks for your patience. 
 
We have validated your reported query and are able to replicate the reported warning at our end. And we have considered this as a bug “Facing an Warning error while running in development mode in Vue 3 at our end and logged a bug request. And it will be included with our upcoming weekly patch release which is scheduled on 15th February 2022. Also, you can check the status of the bug by referring to the below feedback link. 
 
 
Kindly get back to us for further assistance.  
     
Regards,   
Pon selva   
 




LI Liraz January 31, 2022 08:11 AM UTC

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.



PS Pon Selva Jeganathan Syncfusion Team February 1, 2022 05:27 PM UTC

Hi Liraz ,   
 
Thanks for the update. 
 
Query: Does this warning cause the original issue I am facing during production?  
 
No, this warning issue shows in the normal rendering(without using column template) of the treegrid component. 
 
Query: column template is not working with vue 3 in production 
 
We were unable to reproduce the issue(Column template is not working) at our end. 
 
Please refer to the below sample, 
 
Please refer to the below screenshot: 
 
 
 

After following the above reference, still faced issue please share us the following details.

  1. Share video demo or screenshot of the issue
  2. If possible, reproduce the issue in the attached sample or share the issue reproducible sample.
  3. Share the network tab details
 

The provided information will be helpful to provide you response as early as possible.  

Note: In your shared code snippet, the child mapping or id mapping and parent id mapping property is not binded properly. Kindly ensure this case.

Regards,  
Pon selva   



LI Liraz February 2, 2022 02:23 PM UTC

Hi,

I can't run the project example you provided in production. I am getting the following error on console:

error-on-console.PNG

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,



PS Pon Selva Jeganathan Syncfusion Team February 3, 2022 03:16 PM UTC

Hi Liraz ,   
 
Sorry for the inconvenience 
 
We modified the shared sample. Please refer to the below sample, 

Kindly get back to us for further assistance.

Regards,  
Pon selva   


 



LI Liraz February 3, 2022 07:44 PM UTC

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.


Marked as answer

PS Pon Selva Jeganathan Syncfusion Team February 4, 2022 03:12 PM UTC

Hi Liraz, 

Thanks for the update. 
 
We are glad to hear your query has been solved. 
 
Kindly get back to us for further assistance. We are happy to assist you. 

Regards, 
Pon selva 




PS Pon Selva Jeganathan Syncfusion Team February 17, 2022 04:48 PM UTC

Hi Liraz,   
 
Sorry for the inconvenience caused. 

Due to some internal complexities we could not include the fix as promised. We are currently working on it high priority and will include it in our
upcoming weekly patch release which is scheduled on 1st March 2022. 
 
Until then we value your patience. 
     
Regards,   
Pon selva   



PS Pon Selva Jeganathan Syncfusion Team March 2, 2022 04:58 PM UTC

Hi Hung,   
 
We deeply regret for the inconvenience caused. 

We are unable to complete it as planned. However, we assure you that the issue will be included with our Volume 1 release without fail.. 
 
Until then we value your patience. 
     
Regards,   
Pon selva   
 



GV Gokulraj Varatharajan Syncfusion Team April 11, 2022 01:01 PM UTC

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



GV Gokulraj Varatharajan Syncfusion Team May 18, 2022 09:26 AM UTC

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



GV Gokulraj Varatharajan Syncfusion Team June 1, 2022 10:05 AM UTC

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


Loader.
Up arrow icon