Want to COPY hidden columns with CTRL+C on the Wijmo grid

Posted by: chhavi.sethi on 30 December 2020, 1:56 pm EST

  • Posted 30 December 2020, 1:56 pm EST

    Hi,

    In the Wijmo grid, we normally copy(with shortcuts keys) the row and paste it over which seems very cool. But I’ve got a case where I want to copy some additional data attached to a row(behind the grid) but not displayed in a column of that row. How can it be possible?

    Thanks

  • Posted 31 December 2020, 7:13 am EST

    Hi Chhavi,

    YOu may use the copying event to copy extra information on clipboard. Please refer to the following code snippet and the sample demonstrating the same:

    grid.copying.addHandler((s, e) => {
        // get clip text
        var text = s.getClipString();
    
        var textRows = text.split("\n");
    
        // add extra row info
        var sel = s.selection;
        for (var r = sel.topRow; r <= sel.bottomRow; r++) {
          textRows[r - sel.topRow] =
            textRows[r - sel.topRow] + "\t" + "rowIndex: " + r;
        }
        text = textRows.join("\r\n");
    
        // put text (with extra row info) in the clipboard
        wjCore.Clipboard.copy(text);
    
        // we're done here
        e.cancel = true;
      });
    

    https://codesandbox.io/s/wijmo-starter-forked-8tlwg?file=/src/index.js

    Regards

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels