How to copy hyperlinks from datatable and paste the values in CSV or Excel

How to copy hyperlinks from datatable and paste the values in CSV or Excel

ozalinferenciaozalinferencia Posts: 3Questions: 1Answers: 0

Hi Folks,

How to copy to clipboard hyperlinks from data table column and paste the values in C S V or Excel.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736

    Maybe there is something more to your question but you should be able to right click the link and copy it. If this isn't what you are looking for please elaborate on what you want to do.

    Kevin

  • ozalinferenciaozalinferencia Posts: 3Questions: 1Answers: 0

    Hi Kevin,
    Thanks for your response.
    But what i want is different case.

    In my datatable,one column say "track link" is there which is anchor link or hyperlink containing icons.

    <a href=' + field.testlink +' target="_blank" > <img class="ythumb" src="{{ url_for('static', filename='images/play_icon.png')}}" width="25" height="25" title="YouTube Video" alt="YouTube Video" /> </a>

    Js code which m using is:

    $(document).ready(function() { $('.chartContainer_links').DataTable({ paging: true, pageLength: 100, searching: false, destroy: true, dom: 'Bfrtip', buttons: [ { extend: 'copy', text: 'Copy Track Link', className: 'btn btn-primary', header: false, exportOptions: { columns: ':contains("Track")' } }, ] }); });

    Now what i want is when exporting or copying it is not coping the "hyperlinks" or values of that anchor tag.I had googled or searched everywhere but not getting the desired result.May be you can help me with this issue.

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736
    Answer ✓

    Try using stripHtml: false of the exportOptions of the Copy button. The stripHtml and other options are discussed here.

    Here is an example:
    http://live.datatables.net/vizivata/1/edit

    Kevin

  • ozalinferenciaozalinferencia Posts: 3Questions: 1Answers: 0

    Hey Kevin,
    Thanks for the response.

    Very close to what i exactly want.

    In http://live.datatables.net/vizivata/1/edit

    if instead of "<a href="datatables.net">Ashton Cox</a>" i want only "datatables.net".
    i.e only the values of anchor tag,not the whole tag.Is that possible.

This discussion has been closed.