You can make a string value in a ViewModel appear as a clickable external hyperlink in MDriven Turnkey by adding the DataIsLink TaggedValue to its ViewModelColumn.
Purpose
Use DataIsLink when a ViewModelColumn contains a URL that should open as a traditional web link in MDriven Turnkey. The column value is used as the hyperlink destination, and Turnkey renders it with the usual link styling and underline.
For example, if a column contains https://www.example.com, tagging that column with DataIsLink makes the value a link to that address.
Add a link column
- In your ViewModel, add or select the ViewModelColumn that provides the URL.
- Set the column's value so that it returns the URL you want the user to open.
- Add the TaggedValue
DataIsLinkto that ViewModelColumn. - Run the ViewModel in MDriven Turnkey and select the rendered link.
The link destination must be supplied as a string value by the tagged column.
Control the displayed text
By default, Turnkey uses the name of the ViewModelColumn as the link text. To provide different text, including text that changes for each row, add a second ViewModelColumn using this exact naming pattern:
<NameOfColumnWithHyperlink>_LinkText
Turnkey uses the value of this _LinkText column as the text shown to the user, while the original DataIsLink column continues to provide the URL.
Example
Assume your ViewModel contains these columns:
| ViewModelColumn | Value | TaggedValue | Result in Turnkey |
|---|---|---|---|
CompanyWebsite
|
https://www.example.com
|
DataIsLink
|
A hyperlink whose destination is https://www.example.com
|
CompanyWebsite_LinkText
|
Visit company website
|
The displayed text becomes Visit company website |
In this example, CompanyWebsite supplies the address and CompanyWebsite_LinkText supplies the label. The _LinkText column can return a different value for each item, so you can show labels such as Open invoice, Supplier portal, or a name from your data.
When to use other column rendering options
DataIsLink is for rendering a string as a hyperlink. Use the tag only when the string is a URL intended for the user to open.
- Use Column.DataIsImageUrl when the string is the URL of an image that Turnkey should display.
- Use Column.DataIsHtml when the value contains HTML that should be inserted into the page as HTML.
- See Column.Texttype for the HTML
inputtype attribute.
See also
- Documentation:Showing data
- Documentation:Data transformation
- Documentation:Column.DataIsImageUrl
- Documentation:Column.DataIsHtml
[[Category:Attributes and data types [Beginner]]]
