:: Forum >>

Image with hyperlink

Hi,

I want to add an image in a cell with a hyperlink that would point to a php page. For example,

an Edit Icon that goes to edit.php

I am really unsure on how to start with this. I would appreciate anyone's help over this.

Emmanuel
Thursday, August 27, 2009
If you mean you want the image to be clickable, I'm not sure if its possible but you can try.

Follow the AW rules for images first. Then change the cell template to obj_name.setCellTemplate(new AW.Templates.Link, column_position)

The link template is subclassed from the ImageText template, which supports both text and image.
Anthony
Friday, August 28, 2009
Also found these previous threads that have solutions -

http://www.activewidgets.com/javascript.forum.18679.4/image-link.html

http://www.activewidgets.com/javascript.forum.15986.7/image-link.html
Anthony
Friday, August 28, 2009
Hi,

Me again! I'm trying to modify the following function:

function aw_cells($dataset){

$rows = array();
while ($record = @mysql_fetch_row($dataset)) {
$cols = array();
$cols[]='"<a href=\"edit_row.php?id=&amp;section_id=1\"><img src=\"images/editIcon.gif\" width=\"25\" height=\"19\"/></a>","<img src=\"images/deleteIcon.gif\" width=\"25\" height=\"19\"/>"';*/
foreach ($record as $value) {
$cols[] = '"'.addslashes($value).'"';
}
$rows[] = "\t[".implode(",", $cols)."]";
}
echo "[\n".implode(",\n",$rows)."\n];\n";
}

The a href seems to be conflicting with the grid and doesn't display properly. The two images show up properly though. What am I doing wrong here?
Emmanuel
Wednesday, September 9, 2009
Hi!

Me again!

OK I've tried to modify the following PHP function

function aw_cells($dataset){

$rows = array();
while ($record = @mysql_fetch_row($dataset)) {
$cols = array();
$cols[]='"<a href=\"edit_row.php?id=&amp;section_id=1\"><img src=\"images/editIcon.gif\" width=\"25\" height=\"19\"/></a>","<img src=\"images/deleteIcon.gif\" width=\"25\" height=\"19\"/>"';*/

foreach ($record as $value) {
$cols[] = '"'.addslashes($value).'"';
}
$rows[] = "\t[".implode(",", $cols)."]";
}
echo "[\n".implode(",\n",$rows)."\n];\n";
}
The a href seems to conflict with the grid as the edit and delete icons don't show up properly. What I am doing wrong here? Appreciate your help!
Emmanuel
Wednesday, September 9, 2009
I solved my problem by using
obj.setCellTemplate(new AW.Templates.ImageText);

Works great now! :)
Emmanuel
Wednesday, September 9, 2009

This topic is archived.


Back to support forum

Forum search