PDA

View Full Version : [CLOSED]formatting grid column as clickable email addr



dlstrawn
05-13-2010, 07:25 AM
I have a grid column that contains an email address and I want to be able to click on the column and send an email to the address in the column. How do I do this? Thanks.

sean.lanktree
05-13-2010, 10:16 AM
Just use a renderer on your column and return html markup (<a href="mailto"....)

dlstrawn
05-13-2010, 10:37 AM
Sean,

Can you please give a full example. Thanks.

richard.milone
05-14-2010, 08:24 AM
What you have now is a simple email address in the column data like this:

youremailaddress@yahoo.com

To make it appear as a hyperlink that will start a new email you would wrap a hyperlink mailto tag around it like this:

<a href="mailto:youremailaddress@yahoo.com">

You can either supply this full string from the back end or use a column renderer as Sean suggests.

dlstrawn
05-14-2010, 08:27 AM
Thank you!

richard.milone
05-14-2010, 08:30 AM
If you wanted to do it by column renderer you should add something like this to the column definition.


renderer: function(value, metaData, record, rowIndex, colIndex, store) {
return '<a href="mailto:' + value + '">';
}

dlstrawn
05-14-2010, 08:33 AM
OK. That's even better.