Extend buttons and get entire cell contents
Extend buttons and get entire cell contents
greenflash
Posts: 58Questions: 5Answers: 0
I'm trying to create a button that copies email addresses to the clipboard. I can do it OK if the column just contains an email address using
extend: 'copy',
text: 'Copy email address'
header: false,
title: null,
customize: function(data) {
return data.replace(/\n/g, ', ').replace(/\r/g, '');
},
exportOptions: {
columns: '#my_col'
}
but how do I get the entire cell contents if the cell contains HTML such as
<a href="joe@example.com">Joe Bloggs</a>
so that I can process the data and extract the href attribute values? The code above just seems to give me "Joe Bloggs".
Answers
OK, I think I have to use a custom button.
Possibly one of the regex expressions in this SO thread will work to get the URL.
Kevin