Select to view content in your preferred language

Copy text to clipboard from a Calcite 'List' Component

316
4
09-05-2024 06:51 AM
dgreenin
Emerging Contributor

Is it possible to copy text to clipboard from a Calcite 'List' Component?

0 Kudos
4 Replies
Sage_Wall
Esri Contributor

Apparently it's not as easy as highlighting the text in the list with the mouse cursor is it...  It looks like the cursor goes into pointer mode and doesn't allow the text to be selected.  One possible work around would be to add a "copy to clipboard" action or even a click event on the list item itself.  The action is probably more intuitive to the end user. https://codepen.io/sagewall/pen/LYKrKWY

0 Kudos
dgreenin
Emerging Contributor

@Sage_Wall Thank you for your input. This looks great!

How might you copy all the 'calcite-list-items' within a 'calcite-list' to the clipboard with one click?

Is it possible to export an entire 'calcite-list' to a csv file?

0 Kudos
Sage_Wall
Esri Contributor

Sure, you could do something like this: https://codepen.io/sagewall/pen/abgPKBb

Loop through all the calcite list items and keep appending to a string that you turn into a CSV Blob and download.

0 Kudos
dgreenin
Emerging Contributor

@Sage_Wall 

This works great! Thank you!

👏👏👏👏👏

0 Kudos