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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to duplicate selected column?

Thread ID:

Created:

Updated:

Platform:

Replies:

142812 Feb 20,2019 04:18 PM UTC Feb 22,2019 12:46 PM UTC Vue 5
loading
Tags: Data Grid
Stefan Tmusic
Asked On February 20, 2019 04:18 PM UTC

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.

Regards.
Michal

Pavithra Subramaniyam [Syncfusion]
Replied On 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. 
 
Regards, 
Pavithra S. 


Stefan Tmusic
Replied On February 22, 2019 07:43 AM UTC

Thanks.
I have done myself.

Pavithra Subramaniyam [Syncfusion]
Replied On 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.  

Regards,  
Pavithra S. 


Stefan Tmusic
Replied On February 22, 2019 08:59 AM UTC

Let me know other answers.
Thanks

Pavithra Subramaniyam [Syncfusion]
Replied On 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'> 
          ... 
   </ejs-grid> 
 
    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. 
 
Regards,  
Pavithra S.   


CONFIRMATION

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

;