Hi Team,
Is it possible to configure a hyperlink template for a column, so that all cells are clickable and the hyperlink template gets concatenated with the cell value, like this:
Hyperlink template: http://my-host/my-compound={0}
| My column |
| abc |
| def |
The first row would show a hyperlink with http://my-host/my-compound=abc
@nico.pulver.novartis.com hi! I’ve made a tiny example for you:
let table = DG.DataFrame.fromCsv(
`compound, link
abc, null
def, null
`);
let view = grok.shell.addTableView(table);
let col = view.grid.columns.byName('link');
col.width = 250;
col.format = `
<div>
<a href="http://my-host/my-compound=#{t.row[compound]}">http://my-host/my-compound=#{t.row[compound]}</a>
</div>`;
col.cellType = 'html';
1 Like
Thanks a lot Diana.
I should have been more precise: I meant if the user could configure this from within the UI? The reason is that different people want to go to different places, depending on what data they are looking at
@donufriienko, this is a nice and simple solution, I like it!
@nico.pulver.novartis.com, currently there is no way to configure it via the UI, although you can write a simple script that would do what Diana did in a user-friendly way, and put that script to a toolbar or a menu. It is actually a pretty good solution - the column will get saved with the layout, etc.
I’m also thinking about starting an initiative for developing a set of standard cell renderers (such as “picture” or “link”) in an external package. We will keep you updated on that subject.
Hey Andrew,
Ok, I see. Since this is a “standard” feature, I’m hesitated to write and manage a custom script for it
But we will still keep it in mind for specific cases, where we in ID can provide a reasonable default without user interaction.
Nico
@skalkin - Hi Andrew. I am new to the community. Did you ever create a renderer to put hyperlinks to images or the png of an image in a cell?
Hi John, welcome!
We have not developed that renderer yet, although some teams have built similar functionality - so perhaps it’s time for us to provide a standard package (along with other spreadsheet-related functionality, such as sparklines). Stay tuned!