Alternate text for hyperlink in datalink field
I've got a working datalink with a field which contains a hyperlink to launch a report. The datalink is a one to many relationship to the featureclass so I cannot use feature hyperlinks for this. The hyperlink works fine, but it is extremely long and ugly. Example Below.
http://servername/BOE/OpenDocument/opendoc/openDocument.jsp?iDocID=ReportIDX&sIDType=CUID&sType=rpt&sOutputFormat=W&lsSTPK=uniquepropertyID
Is there any way for me to make this display alternative text for that link? eg "Report X"?
Thank you!
-
Hi Lauren,
This capability isn't currently possible and we have it filed as a feature request, GVH-11362. Unfortunately it's marked as something that we're not planning to do, but if it's an important feature for your organization you could reach out to our Professional Services team to have it developped for you.
Hope that helps,
Amanda0 -
We have a similar situation where we're creating http links in SQL to display in the datalink results table. The urls are long and not very user friendly. We wanted the link text to simply say "view workorder" instead of the long and ugly url.
I used a css hack to change it. In the custom css you can hide the <a> and then use the :before selector to insert whatever text content you want. This is what ours looks like. Your url scheme and replacement text would be different.
td.bound-visible a[href*="Informer"] { visibility: hidden; width: 40px; } td.bound-visible a[href*="detail"]:before { content: 'View Workorder Details'; visibility: visible; }0 -
That's a neat trick! I'm a css novice, would that css update all <a> tags in <td> tags throughout the viewer, or is it targeting a specific one? 0 -
I'm also a CSS novice, but I believe that example would affect all <td> elements with a class of 'bound-visible' 0 -
Yes, Dan is correct. But it also searches for links with "Informer" or "detail" in the reference. I did further refine this to specifically grab urls in the datalink results table. This was our final version:
div.datalinks-table-widget td a[href*="Informer"] { visibility: hidden; width: 40px; } div.datalinks-table-widget td a[href*="edit"]:before { content: 'Edit Workorder'; visibility: visible; } div.datalinks-table-widget td a[href*="detail"]:before { content: 'View Workorder Details'; visibility: visible; }This selects a div with class datalinks-table-widget, then looks for table data elements <td> nested inside, then looks for <a> tags with certain links inside those. It then hides the default long url and replaces it with either "Edit Workorder" or "View Workorder Details" depending on the url.0 -
We just upgraded to Viewer for HTML5 2.10.1 and the above solution doesn't quite work anymore. They changed how the table is constructed and are also now using a framework that lets you click and drag to change the width of the columns. You can still change the displayed text using this trick, but as far as I know, there's no way to change the width of the columns using css.
Our new css for hiding the long url and replacing it with shorter text:
/* Hide the long url tag */ div.datalinks-table-widget a[href*="Informer"] { visibility: hidden; } /* Hide the nested <span> tag */ div.datalinks-table-widget a[href*="Informer"] span { visibility: hidden; } /* Replace edit links with "Edit Workorder" */ div.datalinks-table-widget div a[href*="edit"]:before { content: 'Edit Workorder'; visibility: visible; } /* Replace detail links with "View Workorder details" */ div.datalinks-table-widget div a[href*="detail"]:before { content: 'View Workorder Details'; visibility: visible; }0 -
Thank you so much for your code Matthew! and for updating it for the new viewer as well - I really appreciate it :) 0
Please sign in to leave a comment.
Comments
7 comments