email link in column
-
I would like to link the word enquire now to send an email that includes the reference for that product e.g JRC00.25-CR-HW-28M. Is this possible?
The page I need help with: [log in to see the link]
-
Hi,
thanks for your post, and sorry for the trouble.
Yes, that’s possible. Please try adding this to the “Custom Commands” text field on the “Edit” screen of the table:
"columnDefs": [ { "render": function ( data, type, row, meta ) { if ( 'display' === type ) { data = '<a href="mailto:[email protected]?subject=' + row[0] + '">' + data + '</a>'; } return data; }, "targets": [ 7 ] } ]Just change the email address from
[email protected]to the correct one.
The text of the link will be what’s currently in that cell. The produce reference will be appended as a parameter so that it will be prefilled in the “Subject” line of the email.Regards,
TobiasNo it hasn’t worked
Hi,
please make sure to copy the code here from the forums, and not maybe from the notification email that you might have received. It’s important that all quotation marks are correct and not written as
".Regards,
TobiasThank you, it has worked but is in the wrong column, how do i change which column it is in?
Hi,
ah, my bad, I mis-counted. Please change the
[ 7 ]in that last line of code to[ 8 ]. That’s the column number (but with counting starting with 0 for the first column).Regards,
TobiasPerfect, thank you so much.
Final question…. how do I change the colour of the top row so that it isn’t blue?
Hi,
no problem, you are very welcome! 🙂 Good to hear that this helped!
For the color question, please see the TablePress FAQ page: https://tablepress.org/faq/change-background-color-table-head-row/
Best wishes,
TobiasP.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!
i will of course give you a 5 star review, I want to add this code to numerous tables but when I tried it wont work on another one??
Hi,
which code? The “Custom Command” for the email link or the CSS code for the table head colors?
The CSS code should actually work globally already, whereas you would have to adjust the “Custom Command” for the other tables, i.e. column numbers, etc.
Regards,
TobiasYes, i copied the code from the first table and changed the number to 9 for this table https://cjk585181093.wpcomstaging.com/product/pet-plastic-bottles/ but it hasnt worked
Hi,
here, the number would also need to be
8! Remember, counting the columns starts with 0 for the first column, so the ninth column is indicated by an8in the code.Regards,
TobiasYou Sir are a wonderful man, thank you
Hi,
no problem, always happy to help! 🙂
Best wishes,
TobiasHi Tobias, is there a way to expand certain rows in a table? If you look at this page https://cjk585181093.wpcomstaging.com/1352-2/ some columns are too thin so cut off to much text
Hi,
you’d need to manually set column widths here, for some other columns, by using “Custom CSS” like https://tablepress.org/faq/column-widths/
In addition, I recommend to add this to the “Custom CSS” textarea on the “Plugin Options” screen of TablePress:
.tablepress, .tablepress * { word-break: normal; word-wrap: normal; }to override some Jetpack CSS code.
After making changes to the CSS, you might then have to flush the cache of the Jetpack plugin, which you seem to be using to CSS minification and concatenation.
Regards,
Tobias
The topic ‘email link in column’ is closed to new replies.