We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Add Columns Programatically Before They Are Auto Generated

Thread ID:





150419 Jan 6,2020 07:16 PM UTC Jan 7,2020 09:15 AM UTC Vue 1
Tags: Data Grid
Marius Lian
Asked On January 6, 2020 07:16 PM UTC

Hi Syncfusion,

I could probably add columns something like this at any time:
var colObj = { headerText: "Ship City", field: "ShipCity", width: 120 };  

But I would like to add columns programatically but as early as possible. So basically add this programatically at run time:

Would it be possible to add this att the data grid's loaded or created event? And if so what is the best way to add it?


Balaji Sekar [Syncfusion]
Replied On January 7, 2020 09:15 AM UTC

Hi Marius Lian, 
Greetings from Syncfusion Support. 
Query #1: Would it be possible to add column to Data Grid in Load or Created event ? 
We have analyzed your query and we can understand that you need to push columns to Grid as early as possible. Yes, you can add columns to Grid in the Load or Created events of Grid. We suggest you to use Load event. This event allows customization of Grid properties before rendering. We have achieved your requirement and created a sample based on your query. Please refer the below code snippet and sample link for more information. 
  <div id="app"> 

import Vue from "vue"; 
import { GridPlugin, Edit, Page, Toolbar } from "@syncfusion/ej2-vue-grids"; 
import { data } from "./datasource"; 


export default { 
  data() { 
    return { 
      data: data, 
      editSettings: { 
        allowAdding: true, 
        allowEditing: true, 
        allowDeleting: true 
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"] 
  methods: { 
    load: function()
      var colObj = { headerText: "Ship City", field: "ShipCity", width: 120 }; 
  provide: { 
    grid: [Page, Edit, Toolbar] 

If we have misunderstood your query, please provide us more details that will be helpful for us to provide you better assistance. 
  1. Please share the full Grid rendering code.
Please get back to us if you need further assistance. 
Balaji Sekar. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon