Manage text before copyBlockToClipboard

Hello,

I can’t find a way to edit my cell content before adding to clipbord because I need to clear some html to get only data.

I use this script find in the docs :

[code] function onKeyPressed(code,ctrl,shift,grid){
if(code==67&&ctrl){
if (!grid._selectionArea) return alert(“Vous devez d’abord sélectionner une cellule dans la grille.”);
grid.setCSVDelimiter(“\t”);
grid.copyBlockToClipboard()
}
if(code==86&&ctrl){
grid.setCSVDelimiter(“\t”);
grid.pasteBlockFromClipboard()
}
return true;
}

      gridpai.enableBlockSelection();
      gridpai.attachEvent("onKeyPress",function(code,ctrl,shift){
          onKeyPressed(code,ctrl,shift,gridpai);
      });[/code]

in the onkepressed function I tryed to use the selection :

              var cInd = grid.getSelectedCellIndex();
              var rId  = grid.getSelectedRowId();
              var txt  = grid.cellById(rId,cInd).getValue();

but the block can be selected with the row not selected

I also tryed with js

document.execCommand("Copy"); 

but it doesn’t work without clicking manualy on firefox.

I used gridpai.getSelectedBlock() but it doesn’t return data.

Thanks a lot for your help !
Loïc

You may try to use the
myGrid._selectionArea object.
For example:
myGrid._selectionArea.LeftTopRow // it is the first row in the block selection
myGrid._selectionArea.RightBottomRow //last row in the block
myGrid._selectionArea.LeftTopCol // first column in the block
myGrid._selectionArea.RightBottomCol //last column in the block

Hello, Thanks for your answer.
I tryed it but it doesnt return any data value. How can I get the value selected in the block?

my function is :
[code] function onKeyPressed(code,ctrl,shift,grid){
if(code==67&&ctrl){
if (!grid._selectionArea) return alert(“Vous devez d’abord sélectionner une cellule dans la grille.”);
//copy()
console.info(grid.getSelectedBlock());
console.info(grid._selectionArea);

          var cInd = grid.getSelectedCellIndex();
          var rId  = grid.getSelectedRowId();
          var txt  = grid.cellById(rId,cInd).getValue();
          console.info(txt);
          
          grid.setCSVDelimiter("\t");
          grid.copyBlockToClipboard()
      }
      if(code==86&&ctrl){
          grid.setCSVDelimiter("\t");
          grid.pasteBlockFromClipboard()
      }
      return true;
  }[/code]

thanks
Loïc

:arrow_right: EDIT : OK, sorry, I understand now… it returns rowId s and col Ids…