Dynamically apply hyperlink to Grid column

Hello. First-time post (so please be gentle if I do something wrong!).

I have found that the help for version 5.x is very robust but for version 6 it is sparse. What I am trying to do is to provide a hyperlink in each cell in a specific column that will open a new tab in the tabbar. I have been successful with the code to open a new tab but I cannot find any reference in version 6 to how to program a column to be linkable. In version 5 there were (at least) two methods:

mygrid.setColTypes("link");

and

<cell>Link^javascript:alert(1);^_top</cell>// link to a function

I’m finding no reference to how to set a column up to be a link column programmatically. How do you define ‘column types’ in version 6 or is there a totally different way of doing what I would like to do? In essence, in my grid the first column is a list of names of employees. I would like to hyperlink those names to an individual tab that allows me to provide additional demographic information.

Could someone please point me in the right direction or provide a snippet?

Thank you!

Hello. No one replied to this request so I reached out to DHTMLX. This is what I was told and I’ve tested it and it works:

Add this line to your column:

template: function(cellValue, row, col){
return “<div class=“pointed” onClick=“myFunction(” + row.id + “)”>” + cellValue + “”
}

Note: row.id must be part of your JSON data.

Style “pointed” is below:

.pointed { cursor: pointer; text-decoration: underline; }

1 Like