link text for URL field in list

LabKey Support Forum (Inactive)
link text for URL field in list Will Holtz  2015-09-10 17:10
Status: Closed
 
I have a list that contains a text field and this text field is used to store an absolute URL to an external web page. Currently the URL gets displayed in the grid view. This takes up a lot of visual space and also doesn't provide any information to the users, as the URLs don't contain any human parseable information. Is there any way to provide a constant link text for all URLs in this column?

this page: https://www.labkey.org/wiki/home/Documentation/page.view?name=urlEncoding
has a related trick where a query is used to generate such a column. However, this results in other functionality lost, such as the ability to edit rows, and I need to retain the list functionality. Additionally, sometimes the field will be empty and then I would like for nothing to be displayed, and I don't think the query solution satisfies this requirement either.

I'm guessing this isn't possible without some on-the-fly replacement via javascript, but maybe someone has another trick.

thanks,

-Will
 
 
jeckels responded:  2015-09-13 17:11
Hi Will,

I don't know of a simple way to do exact what you're requesting. However, in a custom query you could do a CASE WHEN UrlColumn IS NOT NULL THEN 'Go to Site' ELSE NULL END to conditionally show the link text. Additionally, you could create your own Edit column that points to the same URL that the default list UI uses.

Alternatively, you could use XML query metadata to configure your URL column point to a <displayColumnFactory> of your own creation (a Java class that implements org.labkey.api.data.DisplayColumnFactory) that does your desired rendering behavior.

Thanks,
Josh