Skip to main content
1-Visitor
December 17, 2015
Question

Hyperlinking Numeric Grid Column

  • December 17, 2015
  • 2 replies
  • 7921 views

I have a grid column currently formatted as a number and i would like to allow the user to click on the numeric value in that row and navigate them to an external web application passing along some information in the current row to the GET request.

In addition, i need the ability to set the host and port of the url based on some configuration parameters.

I was hoping i could use Composer to format the grid column somehow...but that doesn't seem possible if its already formatted as a numeric value.

I thought about doing this on the sever side but I'm not sure where to start. The data is numeric, however, i want to format it as a number and hyperlink.

Any advise would be appreciated.

2 replies

December 18, 2015

So, this isn't really a part of ThWx grid functionality.

But what you can do is use an HTML column and then generate the URL and value on the server side script.

result.AddRow({

     valueColumn: myNumberalue,

     htmlColumn: '<a href="http://google.com">' + myNumberValue + '</a>'

});

rtaylor-31-VisitorAuthor
1-Visitor
December 21, 2015

I tried to do it using an HTML column, but it just displayed the raw markup instead of a clickable link.

December 21, 2015

I think there are some ThingWorx versions that had a bug in there that prevented this from working properly, you;ll have to check the release notes to find where it was broken and then fixed. But I use this method all of the time and it does get you what you want - different end point for different columns. You can get really fancy here, including images referenced to their location on your ThWx server, and all sorts of other cool stuff that HTML opens the door to.

Also note that you might have to add more HTML in there to adjust the target


Pai's solution does work as well, I've done that one too, but it does break down when you want two columns to link differently. You'd need some other method of choosing and I can't think of any automatic way of doing it.

If for some reason you cannot get the grid to render correctly due to the suspected version bug and cannot upgrade through it, you can always use a repeater to make a fake grid. I did this solution once but it comes with a lot of problems that the grid does not have, mostly to do with column size and especially on responsive layouts, so beware.

1-Visitor
December 21, 2015

Resolve the Link in an additional column that isn't shown in the Grid. Format the Number column to 'encourage' clicking.

use selected row, selected row changed event and a Navigation widget to achieve the effect you want.

rtaylor-31-VisitorAuthor
1-Visitor
December 21, 2015

This may work...however, i have two different column actions in the same row. Depending on which column they click, would determine which external web application they would link to. Not sure how to distinguish that in a row changed event.

Also, through Composer, it wasn't clear how the Navigation widget could navigate to external urls. Looked like it would only navigate to Mashups.

December 21, 2015

Navigation widget is for internal Mashups navigation, but there is a Link widget for everything else. The widget can be clicked or some other event (like a ServiceInvokeCompleted) can be wired to it's Navigate service.