:: Forum >>

Location.href when double clicking on a row?

Hi,
This project is amazing but the code is difficult to understand because there are no comments :)

I wonder if it's possible to do a "document.location.href" when clicking on a row in the table ?

-I've updated this line :
obj.setAction("click", function(src){document.location.href = src.getProperty("item/text")});
-Added 1 column :
["MSFT","Microsoft Corporation", "314,571.156", "32,187.000", "55000","www.microsoft.com"],
.... but the link is modified if you click in different column of the same row (item/text function).

I've also tried to :
- 1 click to highlight a row
- 1 doubleclick redirect to selected row (ie http://www.microsoft.com)
... but I've got a javascript error message when I change obj.setEvent("onclick",function(){this.action("click")})
TO
obj.setEvent("onDblclick",function(){this.action("click")})

You've done a great job! Keep it up!

Cheers,
Alex.
Friday, October 31, 2003
Quick solution can look like this:

<script>
obj.setAction("click", function(src){
var i = src.getProperty("item/index");
document.location.href = this.getDataText(i, 5);
});
</script>

Plus you can hide the last column if you wish:

<style>
.active-column-5 {display: none}
</style>

Better approach would be to build a hyperlink template class for a grid cell – I’ll add this to the wish list :-)

ActiveWidgets
Alex (ActiveWidgets)
Saturday, November 1, 2003
Thanks a million, hyperlink works fine :)

Is it possible to modify row's background color with a "MouseOver" function (or CSS maybe) ?

Alex
Alex
Saturday, November 1, 2003
Wow.. this is great, but can I do the same thing for a specific column in a row?
pyro
Tuesday, February 17, 2004
In you click action handler var i = src.getProperty("row/index") will return the row index and var j = src.getProperty("column/index") will give you the column index.

or

Add the "link" property to the data model, i.e.
obj.getDataLink = function(i, j){return myLinks[i][j]};
and then inside an action handler get the link like
var link = src.getProperty("item/link");
("item" property on the cell level is translated to "data(i, j)" property on the grid level)

or

feed "<a href='...'>...</a>" into the cell instead of a plain text.
Alex (ActiveWidgets)
Tuesday, February 17, 2004
Hi Folks!

I have tried to get this snippet of code you provided to work, but no luck.

<---- Snip ---->
<script>
obj.setAction("click", function(src){
var i = src.getProperty("item/index");
document.location.href = this.getDataText(i, 5);
});
</script>
<---- Snip ---->

I get nothing, undefined or errors. What could i be doing wrong?
Kul
Tuesday, March 2, 2004
You should define at least 6 columns ;-)
You should use this.getProperty("data/text", i, 5) with XML data
Alex (ActiveWidgets)
Tuesday, March 2, 2004
Here is a suggestion template for hyperlinks in the grid

http://www.activewidgets.com/messages/831-3.htm

gbegley
Friday, April 16, 2004
Can this be done with a ondblclick event?
Almost There!
Wednesday, August 3, 2005

This topic is archived.


Back to support forum

Forum search