Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Ask Reuben 1 - Cut and Paste Table Into The Clipboard  (Read 7864 times)
Reuben B.
Four Js
Posts: 1116


« on: April 06, 2020, 06:00:51 am »

When you right-click a TABLE during a DISPLAY ARRAY, you see options Copy Cell, Copy Visible Column, Copy Row, Copy Visible Table.  How can the end-user copy the entire table?

The answer is to Enable Multiple Row Selection, this allows the user to select multiple rows using standard accelerators key and mouse actions appropriate for the front-end,  which they can then Copy to the Clipboard and Paste somewhere, typically into Excel.

To enable Multi-row selection, use the following code in BEFORE DISPLAY ARRAY

Code
  1. CALL DIALOG.setSelectionMode( "screen-record-name", TRUE )

Read more at https://4js.com/ask-reuben/ig-1/

Reuben

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Matt L.
Posts: 1


« Reply #1 on: April 26, 2020, 11:14:47 pm »

Hi Reuben

I am wondering if there is a way to enable the Copy and Paste functionality in a DISPLAY ARRAY on GBC?


Thanks
Reuben B.
Four Js
Posts: 1116


« Reply #2 on: April 27, 2020, 04:34:45 am »

The answer may depend on your browser.

For instance if you run fgl_zoom on Chrome, you should find that if you select Copy All Rows, or Copy Selected Rows, that the appropriate data will be placed in the clipboard (via the cbSet front-call)  and you can paste that into Excel etc.  However if you try the same on Safari, it will popup a window that displays the selected rows in an editable TextEdit and you have to select the appropriate data, press Ctrl-C, and then you can paste this into Excel.

Browsers have historically prevented automatic interaction with the clipboard for security reasons.  You'll find plenty of Stack Overflow questions on the topic such as https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript.  That attitude has softened in recent year, hence new Web Apis such as https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText.  You'll note as of time and writing that API not available in Safari. We have a task to see if we can use this API https://4js.com/support/issue/?id=GBC-2598 but as that is not available in Safari it would not be an improvement on what we have got.


Also your question might be interpreted a different way.  If you were looking for the right-click options when you click on a DISPLAY ARRRAY in GBC, it might be that you want to display the Context Menu rather than the Browser menu when you right-click.  In which case following http://4js.com/online_documentation/fjs-gbc-manual-html/howdoi/customize-theme-vars/genero-context-menu.html will make Copy cell and Copy row actions available.

Reuben




Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines