mydea / handsontable-chosen-editor

Use a chosen select field in a Handsontable.
http://mydea.github.io/handsontable-chosen-editor/
MIT License
63 stars 36 forks source link

how can i use copy AND paste function? #17

Open itwshen opened 5 years ago

itwshen commented 5 years ago

when i use this editor, the copy and paste will not work? how can i deal with this condition ? Please

itwshen commented 5 years ago

when i use handsontable7.0.3.full.js , copyPaste function will not work , but when i use the version handsontable0.19.0 that you use in you example, it can work ; how should i do with handsontable7.0.3?

mydea commented 5 years ago

Sorry, I am currently not actively working on this. I am looking to merge this https://github.com/mydea/handsontable-chosen-editor/pull/16, which might fix your issue (but not sure).

Even-Lau commented 5 years ago

I got stuck on this issue too. Are there any clues to solve this problem? @mydea @stw13813013798

Lokomotom commented 4 years ago

This is for Handsontable 5.0.0

let cp_row, cp_column, cp_row2, cp_data, cp_validate;
function cp_handler(e) {
  var evtobj = window.event? event : e
  if (evtobj.keyCode == 67 && evtobj.ctrlKey){
    cp_data = new Array();
    for(let i = cp_row; i <= cp_row2;i++){
      cp_data.push(table.getDataAtCell(i, cp_column));
    }
    cp_validate = cp_column;
  }
  if (evtobj.keyCode == 86 && evtobj.ctrlKey){
    if(cp_validate != cp_column){
      //alert('Do tohoto sloupce nelze vložit tyto data.');
    } else {
      let setData = new Array();
      for(let i = cp_row; i <= cp_row + cp_data.length - 1;i++){
        setData.push([i, cp_column, cp_data[i-cp_row]]);
      }
      table.setDataAtCell(setData);
    }
  }
}
document.addEventListener('keydown', cp_handler);

then in new Handsontable( etc. copyPaste: false afterSelection: (row, column, row2, column2, preventScrolling, selectionLayerLevel) => { cp_row = row; cp_column = column; cp_row2 = row2; }

xiaosean666 commented 4 years ago

how can i use copy AND paste function?Please