cancel
Showing results for 
Search instead for 
Did you mean: 

How to get copy command after clicking on a link in sapui5?

0 Kudos

Hi,

I am working on SAPUI5. I have json data with three text fields. If I click on a link on table, it should copy JSON data. and we can paste it anywhere. How to do this in sapui5?

Accepted Solutions (1)

Accepted Solutions (1)

irfan_gokak
Contributor
0 Kudos

Hi,

Below code will work for you.

function myFunction() {
  var copyText = document.createElement("input");
  copyText.value = "Your text here";
  document.body.appendChild(copyText);
  copyText.select();
  document.execCommand("Copy");
  alert("Copied the text: " + copyText.value);
}
0 Kudos

yeah. Thanku. its working now. I did some mistake that time

Former Member
0 Kudos

Thanks for tutorial ....

Answers (1)

Answers (1)

desiree_matas
Contributor
0 Kudos

Hello Preety,

Could you provide us with some more details on what you are trying to do? Do you want to display data from a JSON model in a table, copy it to some other place? It is not clear from the description what you really want to do. The SAPUI5 version and controls you are using are also useful to help you.

Best regards,

Désirée

0 Kudos

Hi,

I have a table. All the data in table is fetching through json. There is one field in table called copy link. If I click on link only particular data from JSON should copy, so that if I paste somewhere, the copied JSON data should come.