<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
});
|