function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

lightning:datatable URL column Spring 18

I am using a lightning:datatable to display various fields, including a URL field which links to a printable PDF.

In the Spring 18 release, the URL field in the datatable now points to "javascript:void(0)" in the href attribute and the title attribute now contains the url which I am trying to set in the href field. 

Can someone please provide me a code example on how to get the href refrecne to work correctly?
Pj McQueenPj McQueen
I have the same problem.  99% sure this is a bug.  It works great outside of a community.  Here is my StackExchange post with code samples:

Love to hear if anyone can get URLs to work in a datatable in a customer community.

I was able to get them to work in the standard lightning UI.
Pramodh KumarPramodh Kumar
I had same problem how to use the URL. The main part is to create the columns and how to use the type attribute. I have bolded the URL part on my code

Here is my code how to use URL parameter.
<aura:component implements="force:appHostable" controller="lightningDataTableCtrl">
    <aura:attribute name="mydata" type="Object"/>
    <aura:attribute name="mycolumns" type="List"/>
    <aura:handler name="init" value="{! this }" action="{! c.init }"/>
    <lightning:datatable data="{! v.mydata }" 
        columns="{! v.mycolumns }" 

	init : function(component, event, helper) {
        var columns = [
            {label: 'Account name', fieldName: 'Name', type: 'text', sortable: true},
            {label: 'Website', fieldName: 'Website', type: 'url', typeAttributes: { label: { fieldName: 'AccountName' }, target: '_blank' }}
		var action = component.get("c.getAccounts");
            var state = res.getState();
            if(state=== 'SUCCESS'){

Please let me know if you have any questions

Steve Ross 39Steve Ross 39
Pramodh, in your example can you show the dta you have stored in the fields AccountName and Website? Are these formula fields?