3.2.0

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.
October 31,
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)
November 1,
Thanks a million, hyperlink works fine :)

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

Alex
Alex
November 1,
Wow.. this is great, but can I do the same thing for a specific column in a row?
pyro
February 17,
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)
February 17,
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
March 2,
You should define at least 6 columns ;-)
You should use this.getProperty("data/text", i, 5) with XML data
Alex (ActiveWidgets)
March 2,
Here is a suggestion template for hyperlinks in the grid

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

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

This topic is archived.

See also:


Back to support forum