简体   繁体   English

从交互式网格 Oracle Apex 复制单元格

[英]Copy cell from Interactive Grid Oracle Apex

I'm trying to copy a specific cell from an Interactive Grid (which is in Display Only mode, if that matters), and instead of copying the cell I'm in, I'm copying the whole row.我正在尝试从交互式网格(如果重要的话,处于“仅显示”模式下)复制特定单元格,而不是复制我所在的单元格,而是复制整行。 I can't seem to find any way to copy just the cell.我似乎找不到任何方法来复制单元格。

APEX versión: Application Express 19.1.0.00.15 APEX 版本:Application Express 19.1.0.00.15

Thank you beforehand.先谢谢了。

Oracle Apex does not enable copy functionality to interactive report by purpose. Oracle Apex 不会按目的启用复制功能到交互式报告。 To enable it, you need to use even handler for copy event.要启用它,您需要为复制事件使用偶数处理程序。 This handler should be on the body or document.此处理程序应位于正文或文档上。 It can be achieved through Dynamic Action :它可以通过动态动作来实现:

Event: Custom Custom Event: copy Selection Type: jQuery Selector jQuery Selector: body事件:自定义 自定义事件:复制 选择类型:jQuery 选择器 jQuery 选择器:body

Then add one JavaScript true action with below code:然后使用以下代码添加一个 JavaScript true 操作:

var text, i, selection, gridSel;

var event = this.browserEvent.originalEvent; // need the clipboard event

// we only care about copy from a grid cell ignore the rest

if ( !$(document.activeElement).hasClass("a-GV-cell") ) {

    return;

}

var view = apex.region("emp").widget().interactiveGrid("getCurrentView"); //change "emp" to you IG static id

if ( view.internalIdentifier === "grid") {

    text = "";

    selection = window.getSelection();

    gridSel = view.view$.grid("getSelection");

    for (i = 0; i < gridSel.length; i++) {

        selection.selectAllChildren(gridSel[i][0]);

        text += selection.toString();

        if (gridSel[i].length > 1) {

            selection.selectAllChildren(gridSel[i][1]);

            text += " \t" + selection.toString();

        }

        text += "";

    }

    selection.removeAllRanges();

    event.clipboardData.setData('text/plain', text);

    event.preventDefault();

}

The above will copy the current grid selection to the clipboard when the user types Ctrl+C while in a grid cell.当用户在网格单元格中键入 Ctrl+C 时,上述内容会将当前网格选择复制到剪贴板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM