:: Forum >>
Image Link
Need help in creating an image link for 1st column in Grid. The image displays ok but the link doesn't work. Thanks for any help!
Below is my example code:
var obj = new AW.UI.Grid;
obj.setCellData("cell");
obj.setHeaderText("header");
obj.setColumnCount(2);
obj.setRowCount(2);
var imageLink = new AW.Templates.ImageText;
imageLink.getContent("box/image").setTag("a");
imageLink.getContent("box/image").setAttribute("href", function(){
return this.getCellProperty("link");
});
obj.setCellTemplate(imageLink, 0);
obj.setCellImage("favorites");
obj.setCellLink("
http://www.google.com");
document.write(obj);
Gary
Wednesday, August 30, 2006
The below opens the url but I don't want the text to show a link. I want the link to only work when the image is clicked.
obj.setCellImage("favorites",1);
obj.setCellLink("
http://www.google.com", 1);
obj.setCellTemplate(new AW.Templates.Link, 1);
Gary
Wednesday, August 30, 2006
I do it a different way actually.
Let's say the data set has in it:
"Google","google","
http://www.google.com"
I do this:
// Setting Imp Icons
obj.setCellText(function(col,row){
return "<a target='_new' href='"+
this.getCellValue(3,row) +
"'><img border='0' src='
http://www.domain.com/images/" +
this.getCellValue(1,row) + ".gif'></a>"
},0);
What it does is set column 0 (Google) to the LINK in column 2 (
http://www.google.com" with an image in column 2 (google)
Now, here is the thing. I take the value of "google" from column 1 and add to it in the FRONT the the http location and to the END I add ".gif"
This way, I don't have to use CSS to define ALL the images I need. In my case, I can't use CSS because I'd have about 500 CSS statements. So I just reference the image file on the server directly.
Hope it helps (someone helped me with it).
I do have a working example if you want to see it.
Carl
Wednesday, August 30, 2006
Can you send me a working example or link at gary.riojas@sug.com? Thanks for your help!
Gary
Wednesday, August 30, 2006
Also, I have another grid that has a contract number in column 1 and I want to open a contract search popup by clicking on an image and return the results to the grid. My grid data doesn't have a url in it. I was wanting to open a contract search popup by clicking on an image instead of the actual contract number in column 1. I guess this isn't possible? Maybe I need another column for the image link? Thanks for the help in advance!
Gary
Wednesday, August 30, 2006
Take a look at the link below with Internet Explorer (I have some rework to do to make it function with Firefox:
https://www.pjm.com/planning/project-queues/queue-gen-active.jsp
On the page, click a different "tab" than "R" (which is blank at the moment - so the grid is empty. Pick the "A" Tab.
The FEAS, IMP. FAC, ISA, CSA image dots load a PDF if you click on them.
If you role over the "St" column, it should also display the County as a tooltip.
I'm not exactly sure what you are trying to do with the contract piece, but I'm sure with a little creative coding (and if I understood it better) it is possible.
Carl
Wednesday, August 30, 2006
Thanks for your example and help! I now have an idea how to tackle my problem.
Gary
Thursday, August 31, 2006
Iam a learner for asp.Net
just i want to know the site which has to follow
surandai
Thursday, September 7, 2006
This topic is archived.
Back to support forum
Forum search