:: Forum >>

HELP! I seem to be overwriting my links

I am trying to assign hyperlinks to each column based on the values in column 5 of my CSV file.

the problem is that only the last column hyperlinks seem to work. i cant figure out what i am doing wrong. can someone give me a hand?

this is my code:

// set col 1 hyperlinks
obj.setCellLink("javascript:void(1);", 0,0);
obj.setCellTemplate(new AW.Templates.Link, 0);
obj.onCellClicked = function(event, col, row){if (col==0 ) {window.open(href="http://"+(this.getCellText(4, row))); return false;};};

// set col 2 hyperlinks
obj.setCellLink("javascript:void(1);", 1);
obj.setCellTemplate(new AW.Templates.Link, 1);
obj.onCellClicked = function(event, col, row){if (col==1 ) {window.open(href="http://"+(this.getCellText(4, row))); return false;};};

// set col 3 hyperlinks
obj.setCellLink("javascript:void(1);", 2);
obj.setCellTemplate(new AW.Templates.Link, 2);
obj.onCellClicked = function(event, col, row){if (col==2 ) {window.open(href="http://"+(this.getCellText(4, row))); return false;};};

// set col 4 hyperlinks
obj.setCellLink("javascript:void(1);", 3);
obj.setCellTemplate(new AW.Templates.Link, 3);
obj.onCellClicked = function(event, col, row){if (col==3 ) {window.open(href="http://"+(this.getCellText(4, row))); return false;};};
Thursday, February 11, 2010
Are the values in column 5 separated by any char?
like :
"www.google.com;www.yahoo.com;www.msn.com;www.xe.com;www.jr.com"
if so, then you can 'split' the substring values;

// set col all 4 hyperlinks
obj.setCellLink("javascript:void(1);", 0,0);
obj.setCellTemplate(new AW.Templates.Link);
obj.setCellTemplate(new AW.Templates.Text, 4);

obj.onCellClicked = function(event, col, row){
var cell4Text = this.getCellText(4, row);
var arraycell4 = cell4Text.split(';');
if (col==0 ) {window.open(href="http://"+arraycell4[0] );}
if (col==1 ) {window.open(href="http://"+arraycell4[1]);}
if (col==2 ) {window.open(href="http://"+arraycell4[2]);}
if (col==3 ) {window.open(href="http://"+arraycell4[3]);}
}
Thursday, February 11, 2010
Thanks. i see what i did wrong. this is the corrected code for me.

// set col hyperlinks
obj.setCellLink("javascript:void(1);", 0);
obj.setCellLink("javascript:void(2);", 1);
obj.setCellLink("javascript:void(3);", 2);
obj.setCellLink("javascript:void(4);", 3);

obj.setCellTemplate(new AW.Templates.Link, 0);
obj.setCellTemplate(new AW.Templates.Link, 1);
obj.setCellTemplate(new AW.Templates.Link, 2);
obj.setCellTemplate(new AW.Templates.Link, 3);

// now navigate to proper page onclick
obj.onCellClicked = function(event, col, row){
if (col==0 ) {window.open(href="http://"+(this.getCellText(4, row))); return false;}
if (col==1 ) {window.open(href="http://"+(this.getCellText(4, row))); return false;}
if (col==2 ) {window.open(href="http://"+(this.getCellText(4, row))); return false;}
if (col==3 ) {window.open(href="http://"+(this.getCellText(4, row))); return false;}
}
matt
Thursday, February 11, 2010

This topic is archived.


Back to support forum

Forum search