Crud: [HowTo] Copy Text to clipboard from CRUD list?

Created on 3 Jul 2020  路  3Comments  路  Source: Laravel-Backpack/CRUD

Hello!

I'm want to copy to clipboard the value of a column by clicking on this value. But in the documentation I didn't find how to use javascript in "wrapper". Any examples?

When I run php artisan backpack:version the output is:

Bug

Most helpful comment

You probably mean the list view,
To copy column content to the clipboard you should add some custom javascript
This can be done using the list.js file, details here
Here is an example of the js code, https://stackoverflow.com/a/48927455 make sure you adjust element selector. Then it should work.
For more questions please ask them on stackoverflow or another channel.

All 3 comments

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps _a lot_ in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication channels:

  • Bug Reports, Feature Requests - Github Issues (here);
  • Quick help (_How do I do X_) - Gitter Chatroom;
  • Long questions (_I have done X and Y and it won't do Z wtf_) - Stackoverflow, using the backpack-for-laravel tag;
  • Showing off something you've made, asking for opinion on Backpack/Laravel matters - Reddit;

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome _awesome_ community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

--
Justin Case
The Backpack Robot

You probably mean the list view,
To copy column content to the clipboard you should add some custom javascript
This can be done using the list.js file, details here
Here is an example of the js code, https://stackoverflow.com/a/48927455 make sure you adjust element selector. Then it should work.
For more questions please ask them on stackoverflow or another channel.

Thanks @martijnb92 for pitching in.

I would just add that you can pass a string or a function to the wrapper.

Something like:

'onClick' => "(function(){
    alert('Hey i am calling');
    return false;
})();return false;";

Not sure this is the solution that you need, it might need more work that adding js into the wrapper.

Best,
Pedro

Was this page helpful?
0 / 5 - 0 ratings