copying to clipboard issue

copying to clipboard issue

samirllsamirll Posts: 7Questions: 1Answers: 0

Hello everyone,

I am using copy button on my reports. The issue I am facing is that on some page it says x number of rows are copied to clip board while on some other pages it says '' Press ctrl or ⌘ + C to copy the table data to your system clipboard.To cancel, click this message or press escape"

I am not sure what and where is the issue. I need the auto copy feature and don't want the user to press ctrl + c.

Any idea? how an I fix this issue?

Regards
Sami

Answers

  • kthorngrenkthorngren Posts: 20,294Questions: 26Answers: 4,768

    Do you have keyboard activation enabled on those buttons?
    https://datatables.net/extensions/buttons/examples/initialisation/keys.html

    Kevin

  • samirllsamirll Posts: 7Questions: 1Answers: 0
    edited March 2017

    @kthorngren No I don't have as such settings here is my code:

    $(document).ready(function() {
    var table = $('#property_list').DataTable(
    {
    dom: 'Bfrtip',
    "columnDefs": [
    {
        "targets": [ 0 ],
        "searchable": true,
    },
    {
        "targets": [ 1 ],
        "visible": true,
    },
    {
        "targets": [ 2 ],
        "visible": true,
    },
    ],
    buttons: [
    'copyHtml5',
    'csvHtml5',
    'pdfHtml5',
    'print'
    
    ],
    fixedHeader: true,
    paging: false
    
    });
    
  • samirllsamirll Posts: 7Questions: 1Answers: 0
    edited March 2017
    <link rel="stylesheet" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css">
    <link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.2.4/css/buttons.dataTables.min.css">
    <link rel='stylesheet' id='datatables-fixedheader-css'  href='https://cdn.datatables.net/fixedheader/3.1.2/css/fixedHeader.dataTables.min.css' type='text/css' media='all'>
    
    
    <script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.2.4/js/dataTables.buttons.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
    <script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.24/build/pdfmake.min.js"></script>
    <script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.24/build/vfs_fonts.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.2.4/js/buttons.html5.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.2.4/js/buttons.print.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/fixedheader/3.1.2/js/dataTables.fixedHeader.min.js"></script>
    <script src="../../../js/jquery.table2excel.js"></script>
    
  • samirllsamirll Posts: 7Questions: 1Answers: 0

    @allan need your help.

  • kthorngrenkthorngren Posts: 20,294Questions: 26Answers: 4,768
    edited March 2017

    This may explain your issue:
    https://datatables.net/reference/button/copyHtml5

    Sounds like its browser dependent on whether that message appears. Looks like you are using the latest buttons version.

    Kevin

  • samirllsamirll Posts: 7Questions: 1Answers: 0

    I am using the same code and same browser for these pages. On some pages it works while on few others it doesn't.

  • allanallan Posts: 61,695Questions: 1Answers: 10,102 Site admin

    Can you link to the two pages please so it can be debugged?

    The "press cmd+c" message will be shown if there is an error when executing the execCommand. If that is failing we'd need to be able to debug the page to understand why that is happening.

    One possibility is the amount of data in the table, but again, we'd really need a link to the page.

    Allan

  • samirllsamirll Posts: 7Questions: 1Answers: 0

    Hey @allan those are admin pages. I may not be able to share it publically. any other thoughts?

  • tangerinetangerine Posts: 3,348Questions: 36Answers: 394

    On some pages it works while on few others it doesn't.

    At the very least you have to explain the details of the differences between the relevant pages.

  • allanallan Posts: 61,695Questions: 1Answers: 10,102 Site admin
    edited March 2017

    Another option is to remove that try/catch in the code and see what the exception says.

    edit Or use a breakpoint in there, which is what I would have done with access to the page.

  • samirllsamirll Posts: 7Questions: 1Answers: 0

    @allan removing the try and catch don't have any impact on the behavior and do not provide any information. but the amount of data is also not an issue. It has something with the processing of data.

    @tangerine I am trying to figure out the difference between segments of code.

  • allanallan Posts: 61,695Questions: 1Answers: 10,102 Site admin

    Without any way to reproduce the issue I'm afraid there isn't really anything I can do to help other than to generically suggest debugging it. I haven't come across anyone else reporting this so it isn't a known issue with a known solution I'm afraid.

    Allan

  • JaMoDiJaMoDi Posts: 2Questions: 0Answers: 0
    edited December 2017

    Sorry, my english is very bad. I've same problem. The origin of my problem is the virtual memory. Increase the size of virtual memory of your computer.

  • JaMoDiJaMoDi Posts: 2Questions: 0Answers: 0

    I correct. In my case it is not the virutal memory, but it seems that it is the memory that the operating system reserves to the clipboard application, when it is full it gives this error. On different computers, it shows me this error with different number of records for the same query.

This discussion has been closed.