Community Tip - You can change your system assigned username to something more personal in your community settings. X
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.
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>'
});
I tried to do it using an HTML column, but it just displayed the raw markup instead of a clickable link.
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.
Ok....maybe i'm doing something wrong...i'm using ThingWorx6.6
Ok....i almost have what i need. I used an HTML column and then had to configure the column formatting for formatted HTML.
However, now, if i add request parameters to the url, it does the following:
actual column content: <a href="http://www.yahoo.com?id=47">337</a>
When i click on the column i get the following url in the address bar:
It's placing a "/" after the url and before the request parameters
I would have thought a webserver would treat both of these identically:
I am not sure why it's rendering the link like that, but for your specific example, chrome does this to any URL sent in. I type this in my address bar
and then chrome changes it to
So is this an actual problem? I would check this in other browsers, to see if it's similar, and of course, if it even matters.
Chrome doesn't behave this way for me. I pasted http://www.yahoo.com?id=47 in the address bar and hit enter, the page refreshed, and the url remained unchanged.
In any case, i found that for my actual use case (where i'm not linking to yahoo, but to a different web application), that url contains additional path information and the url is unaltered. For example, for a url like http://www.yahoo.com/someresource.html?id=47 works...meaning the url isn't altered.
Confirmed working on 5.0.2 it is working just fine.
Confirmed not working on 6.0.2 and 6.0.5
Confirmed working on 6.5.0
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.
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.
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.