You need to sign in to do that
Don't have an account?
meghna n
lightning datatable columns issue
I have a lightning datatable as follows. I have given piece of code which I have done.
<aura:attribute name="mydata" type="Object"/>
<aura:attribute name="mycolumns" type="List"/>
<aura:attribute name="openEOBLink" type="String" default=""/>
<lightning:datatable
keyField="id"
data="{!v.mydata }"
coumns="{!v.mycolumns }"
hideCheckboxColumn="true"/>
Controller.js
doInit : function(component, event, helper) {
helper.bindDatatableColumns(component,event,helper);
}
Helper.js
bindDatatableColumns : function(component,event,helper){
component.set('v.mycolumns', [
{ label: 'Version',
fieldName: 'Version',
type: 'text',
sortable:true,
cellAttributes: {alignment: 'center'}
},
{
label: 'EOB/EOP',
fieldName: 'EOBEOP',
sortable:false,
type: 'text',
cellAttributes: {alignment: 'center'}
}
component.set('v.mydata', [{
id: 'a',
Version:'1',
EOBEOP: component.get("v.openEOBLink")
},
component.set("v.openEOBLink",'/lightning/n/GPS_Search_EOB?c__claimId=' + component.get("v.claimId") +
'&c__dateOfService=' + component.get("v.dateofservice") +
'&c__memberId=' + component.get("v.memberId") +
'&c__memberNameforProvider=' + component.get("v.memberName") +
'&c__legalOwnerName=' + component.get("v.ownerName"));
} //Helper class ends here
I am able to display the datatable values and when I click on EOB link in datatable it will take me to an app Builder page by passing the parameter values.
My requirement is as follows:
a. In datatable column value I want to separate EOB and EOP
clickable links so when I click EOB link it will navigate to EOB
appbuilder page similarly when I click EOP link it will navigate to
EOP app Builder page.
I have provided a sample code of app builder page and the
parameters which I need to pass
Please help me with correct code how I can achieve my requirement.
Thanks
meghna
<aura:attribute name="mydata" type="Object"/>
<aura:attribute name="mycolumns" type="List"/>
<aura:attribute name="openEOBLink" type="String" default=""/>
<lightning:datatable
keyField="id"
data="{!v.mydata }"
coumns="{!v.mycolumns }"
hideCheckboxColumn="true"/>
Controller.js
doInit : function(component, event, helper) {
helper.bindDatatableColumns(component,event,helper);
}
Helper.js
bindDatatableColumns : function(component,event,helper){
component.set('v.mycolumns', [
{ label: 'Version',
fieldName: 'Version',
type: 'text',
sortable:true,
cellAttributes: {alignment: 'center'}
},
{
label: 'EOB/EOP',
fieldName: 'EOBEOP',
sortable:false,
type: 'text',
cellAttributes: {alignment: 'center'}
}
component.set('v.mydata', [{
id: 'a',
Version:'1',
EOBEOP: component.get("v.openEOBLink")
},
component.set("v.openEOBLink",'/lightning/n/GPS_Search_EOB?c__claimId=' + component.get("v.claimId") +
'&c__dateOfService=' + component.get("v.dateofservice") +
'&c__memberId=' + component.get("v.memberId") +
'&c__memberNameforProvider=' + component.get("v.memberName") +
'&c__legalOwnerName=' + component.get("v.ownerName"));
} //Helper class ends here
I am able to display the datatable values and when I click on EOB link in datatable it will take me to an app Builder page by passing the parameter values.
My requirement is as follows:
a. In datatable column value I want to separate EOB and EOP
clickable links so when I click EOB link it will navigate to EOB
appbuilder page similarly when I click EOP link it will navigate to
EOP app Builder page.
I have provided a sample code of app builder page and the
parameters which I need to pass
Please help me with correct code how I can achieve my requirement.
Thanks
meghna
Once you get your data you can do like this
I hope you find the above solution helpful. If it does mark as best answer to help others too.
Thanks,
Ramesh D
All Answers
Can u provide the screenshot of your data table? it would be helpfull to understand the requirement.
Thanks
Arun
I have atatched a screen shot of the datatable.
But is it possible in a single column to have two different clickable links?
Kindly respond at your earliest.
thanks
meghna
Once you get your data you can do like this
I hope you find the above solution helpful. If it does mark as best answer to help others too.
Thanks,
Ramesh D
This is not possible with <lightning:datatable/>. The above code will give you the link in seperate columns.
Thanks
Arun Kumar
You can find example here: https://newstechnologystuff.com/2019/01/01/lightning-datatable-lazy-loading-with-inline-editing-and-actions/
Thanks
Tushar
https://newstechnologystuff.com/
This worked.Thanks very much.
meghna