Get KoolPHP UI with 30% OFF!

Is there a simple way of making editable and hyperlinked column?

Ron Grayson
I want to make a gridboundcolumn that is a hyperlink when you are not editing.
Specifically, I want to display an email address. If you want to, you should be able to edit it.
(That works now using GridBoundColumn)
But when you AREN'T editing, I want to display the email as a "mailto:" hyperlink so people can click and send an email to that address.
I can use a GridCustomColumn to DISPLAY the email as hyperlink -- but then I lose the editing!
Is there some simple way to combine these to to do both?
- Larry Groebe
Dallas Texas
Posted Mar 8, 2016 Kool
Hallie
Hi Ron,
Can you show how you are able to create the DISPLAY email hyperlink via a CustomColumn? I can't figure out how to add the mailto hyperlink. Thanks for your help!
Posted Jun 1, 2017 Kool
Anthony Amolochitis
To display a mailto hyperlink here is your href in your anchor tag.
<a href="mailto:example@email.com">your anchor text</a>

If you are trying to edit some field and display it as well, but the edit value is different than the display value, you need to use custom edit templates.
I shared some edit templates here.
https://www.koolphp.net/forum/threads/95.1/using-the-insert-and-edit-template.html
Also, you can view the docs on how to use them as well. Here is their edit template.
http://doc.koolphp.net/Controls/KoolGrid/PHP/GridTemplate/index.php#Render
Posted Jun 2, 2017 Kool
Hallie
can you show me how to add the variables within a KoolPHP grid? I can't get the email address to populate? This is not working.
$columna = new GridBoundColumn();
    $columna->DataField = "email";
    $grid->MasterTable->AddColumn($columna);
	
	$columnEmail = new GridCustomColumn();
	$columnEmail->ItemTemplate  = "<a href=mailto:$columna>$columna</a>";
	$grid->MasterTable->AddColumn($columnEmail);
Posted Jun 5, 2017 Kool
Anthony Amolochitis
Your data field is "email"
So change your row with the ItemTemplate to :
...
$columnEmail->ItemTemplate  = "<a href=mailto:{email}> {email} </a>";
...

You might need quotes around the href string though. I didn't check on that.
This should work though.
Posted Jun 5, 2017 Kool
Hallie
That works!! Thank you
Posted Jun 5, 2017 Kool -