:: Forum >>

Make row hyperlink

I'm hoping someone can help me out. I'm wanting all the cells in a given row to link to the same location. Currently, I have the following code:

// LINKS
obj.setCellLink(myCells);
obj.setCellTemplate(new AW.Templates.Link);

This works, however each cells link is the cell value. Each row has a PK in the MySQL database. What I'm wanting is that when a user clicks on the row, it will load up an edit screen at which time they can edit/save the data. Is there a way to get this to populate the setCellLink variable with the PK that it's pulling from the database? (for the sake of this exercise, let's assume that the PK is stored in t1.studyNum ).

I am using the following code to query/populate the cells:

function aw_cells($dataset){

$rows = array();
while ($record = @mysql_fetch_row($dataset)) {
$cols = array();
foreach ($record as $value) {
$cols[] = '"'.addslashes($value).'"';
}
$rows[] = "\t[".implode(",", $cols)."]";
}
echo "[\n".implode(",\n",$rows)."\n];\n";
}

Thank you!
Confused...
Thursday, July 31, 2008
It is not possible to assign 'link template' for the whole row, but you can listen for onRowClicked or onCellClicked event and navigate to another page programmatically.

grid.onRowClicked = function(event, rowIndex){
window.location = "new URL" + rowIndex;
}
Alex (ActiveWidgets)
Friday, August 1, 2008
Thanks Alex... I'm assuming you meant obj.onRowClicked and now grid.onRowClicked.

That works, however, is there a way to get, instead of the rowindex, the value of t1.studyNum for that row array to populate instead of the rowindex? (since the row index !=studyNum.

Confused...
Friday, August 1, 2008
Just interjecting ...

Well, I'm assuming that one of the columns (even if it isn't visible) holds the studyNum value

So, if you get the row index, you could also be able to get the value in a specific column - thus, the studyNum.

So, if the onclick event returns the rowindex of 5, and the studyNum value (we'll say 320) is stored in column 15,

obj.getCellValue(5,15); would give you 320

Kinda of the overview anyway - I haven't been playing with AW in a few months. So, keep in mind, I might have the two values switched - it might be 15,5. lol
Tuesday, August 19, 2008

This topic is archived.


Back to support forum

Forum search