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

How to duplicate selected column?

I am gonna duplicate selected row and column.
I know the way to duplicate the selected row and cell.
Let me know the way to duplicate the selected column.


5 Replies

PS Pavithra Subramaniyam Syncfusion Team February 21, 2019 08:36 AM UTC

Hi Michal, 
We have analyzed your requirement and If you define same field name for two columns then it will be displayed as duplicate columns in Grid at initial loading. 
We are not certain about your exact requirement. We need more details to look into this and provide you a solution. Could you please share the following details for better assistance. 
  1. What is your need to duplicate the columns? At which case?
  2. Share a video demonstration explaining your exact requirement.
  3. Share your complete requirement.
  4. Share a brief description of your complete requirement.
The provided information will help us analyze your requirement, and provide you a solution as early as possible. 
Pavithra S. 

ST Stefan Tmusic February 22, 2019 07:43 AM UTC

I have done myself.

PS Pavithra Subramaniyam Syncfusion Team February 22, 2019 08:57 AM UTC

Hi Michal,  

Thanks for your update. 

We are happy to hear that you have achieved your requirement. 

Please contact us if you need any further assistance. As always, we will be happy to assist you.  

Pavithra S. 

ST Stefan Tmusic February 22, 2019 08:59 AM UTC

Let me know other answers.

PS Pavithra Subramaniyam Syncfusion Team February 22, 2019 12:46 PM UTC

Hi Michal, 
We suggest you to push the “column object” of column you wish to duplicate in the “columns” property of Grid. In the below code, in a button click event we have took the instance for the Grid and pushed the column object to be duplicated in the “columns” property and finally we have called the “refresh()” method to reflect the changes in Grid. Please refer the code example below, 
  <button id="duplicate">Duplicate column</button> 
   <ejs-grid id="Grid" :dataSource="data" height='315px'> 
    document.getElementById("duplicate").addEventListener("click", (e) => { 
        var obj = document.getElementById('Grid').ej2_instances[0]   //Get the instance for Grid 
        var duplicate = obj.columns[0];             //Get the column to duplicate(Here we have took the first column) 
        obj.columns.push(duplicate);                //Push the column object of the column to be duplicated 
        obj.refresh();                                            //refresh the Grid to show the changes 
We are also attaching the sample for your convenience, please download the sample from the link below, 
Documentations :  
Please get back to us if you need further assistance. 
Pavithra S.   

Live Chat Icon For mobile
Up arrow icon