Author Topic: Copy From Excel On Sheet2 not working  (Read 346 times)

Punit

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 46
    • View Profile
Copy From Excel On Sheet2 not working
« on: July 07, 2022, 12:53:00 pm »
Dear Team,
We try to copy from sheet 2 but we always get the value of sheet 1. We write the below code to copy from 1 grid and paste it to another grid. Is there any alternate way to achieve this? Also if we copy a value from sheet 2 and copy this value to the clipboard then it works fine in local but not in production.


var $grid = $('#spreadsheet').closest(".pq-grid");
 $grid.pqGrid("copy");

var $grid1 = $('#tree_grid').closest(".pq-grid");
$grid1.pqGrid("paste");

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Copy From Excel On Sheet2 not working
« Reply #1 on: July 07, 2022, 02:39:55 pm »
use Tab API to work with worksheets.

If you want to copy from sheet2, then activate and focus on sheet2 and then copy from it.

Code: [Select]
var T = this.Tab();
T.activate(1); //assuming sheet2 is at 1 index in tabs array collection.
var grid2 = T.grid( T.activeTab());
grid2.focus({rowIndxPage: 1, colIndx: 1});
grid2.Range({r1:1,c1:1, rc:2,cc:2}).copy();
« Last Edit: July 07, 2022, 02:42:55 pm by paramvir »