Questions tagged [lightning-datatable]

A table that displays columns of data within lightning experience, formatted according to type. This component requires API version 41.0 and later.

Filter by
Sorted by
Tagged with
18 votes
1 answer
3k views

How do I get lightning:datatable to do some undocumented thing X?

Canonical Question I want to do <some really cool thing> with a lightning:datatable, but I can't seem to figure out how to do it. I checked the documentation, but I did not see a way to ...
13 votes
6 answers
14k views

How to convey LWC's complex Reactive property back to markup?

From SF docs: There are some limitations on the depth of changes tracked for rerendering in reactive properties. The tracking depth depends on the type of the reactive property. Lightning ...
Pranay Jaiswal's user avatar
12 votes
1 answer
20k views

How to use custom LWC lightning component in lightning-datatable

If we want to have custom lightning component in LWC lightning-datatable, for example Upload file for each of the records, how can we do that?
salesforce-sas's user avatar
6 votes
3 answers
14k views

Flatten data to display it using lightning datatable in LWC

My wrapper class returns sObjects of type account and contact along with other fields, to my LWC. I am not able to display the data using lightning datatable as something like fieldName:'AccountId....
Koustubh's user avatar
  • 1,143
13 votes
2 answers
62k views

Hyperlink record name LWC datatable

I am trying to fetch List of sobjects and show them in data table. I want to add a hyperlink to record name. I am using @wired property to dynamically get records depending on the search term. my test....
SFlearner's user avatar
  • 141
13 votes
4 answers
7k views

lightning:datatable not rendering correctly

I'm having troubles with rendering my datatable correctly. There are actions added but it seems the datatable is not high enough to view it correctly. Is it something I'm doing wrong? Or is it a bug? ...
Nielsm's user avatar
  • 2,084
7 votes
2 answers
18k views

(LWC) - Lightning Datatable: Custom Data Types

Is it possible to create lookup fields and picklists with custom data types now? Documentation says: Create your own data types if you want to implement a custom cell, such as a delete row button ...
Atlas Can's user avatar
  • 1,877
6 votes
1 answer
15k views

Lightning:datatable dynamically disable rowactions

I have a lightning:datatable, which is rendering a set of objects: <lightning:datatable data="{!v.propertyMappings}" columns="{!v.columns}" ...
jordan.baucke's user avatar
2 votes
3 answers
17k views

Lightning Web Component: Can we catch rowclick event lightning-datatable just click

I want to make lightning-datatable with row-click event. It's without checkbox or onrowaction pulldown or link like below. I'm looking for lightning-table events, but almost article uses onrowaction. ...
Asae's user avatar
  • 25
11 votes
2 answers
46k views

Hyperlink a Record in lightning:datatable

Am trying to accomplish a POC in my project. We have a lightning Datatable using . I could generate a set of records to display on the component. But I need one column to be hyperlinked to navigate to ...
Guha Arumugam's user avatar
5 votes
4 answers
19k views

lightning:datatable component - hiding Save and Cancel buttons after inline edit

I've been testing out the new inline edit feature for the lightning:datatable component in a Summer '18 sandbox, but I can't seem to work out how to hide the Save and Cancel buttons after I complete ...
Carlo I's user avatar
  • 183
4 votes
1 answer
4k views

lightning datatable (AURA or LWC) can automatically fetch records from database?

Is it possible to fetch records automatically from database just by mentioning columns? Also can we use relationship fields to get data without any processing? For example CreatedBy.Name ? Other ...
salesforce-sas's user avatar
3 votes
1 answer
2k views

What is the limitation on size of list attribute in Lightning component?

We have created a lightning component where we are displaying transaction records. We have used lightning datatable and also implemented pagination. Data that is to be displayed is retrieved by API ...
pk123's user avatar
  • 71
3 votes
2 answers
7k views

Clear selectedRows after deleting records in lightning-datatable

I am trying to clear the selected rows after a deletion action. The delete actions works perfectly. After the Delete from APEX, it performs a refreshApex() which works fine too. However, the checked ...
Nadine Thery's user avatar
2 votes
1 answer
7k views

How to control the height of datatable dynamically in LWC?

I wish to control the height of a datatable based on the number of records present. If there are less than 10 rows, the height of the datatable should be just enough to show all rows. There should ...
Koustubh's user avatar
  • 1,143
1 vote
2 answers
8k views

LWC Salesforce Get Parent in Datatable Column

I know that this question is out there however I am still a bit stuck. I am trying to make this as simple as possible. I am trying to make the Parent Value show in my Lightning datatable. Show ...
CodeMonger's user avatar
1 vote
1 answer
2k views

Construct data table columns on the fly dynamically

Note - I followed the approach from this link - How to make columns lwc lightning-datatable dynamic with button-icon I am trying to build a data table like below: The column has dates which is start ...
SfdcBat's user avatar
  • 4,791
1 vote
1 answer
3k views

How do we pass the field api name in lwc for a lightning data table?

I have fetched all the fields to be displayed on the datatable in my apex query. In my js file where i store the column details @track columns = [{ label: 'Deal Name', fieldName: '...
tamanna's user avatar
  • 11
1 vote
2 answers
4k views

Pre selected Rows with Pagination not working in Datatable in Saleforce LWC

I am loading the user table data to ligtning datatable. Intially the page loads, I load all the user list list to front end and using pagination Im going through the records instead going to the ...
lochana's user avatar
  • 27
-2 votes
2 answers
3k views

How to deselect the checkbox when max row selection is set to 1 in LWC? [closed]

Hi I'm new to LWC and I have worked on the data table where it's iterated one so its shows like multiple tables in real-time now in each table the user will pick only one option from the selection so ...
grey 123's user avatar
22 votes
2 answers
35k views

Spring 18 <lightning:datatable> how to add a button column

I was waiting for the new release of the lightning:datatable component to see if now with new version this component could be useful to really suit my needs. One main feature is the row actions - it ...
Itai Shmida's user avatar
  • 5,025
9 votes
2 answers
8k views

Setting a max height for datatable in LWC?

I know when you specify a div with a height around your datatable you get a nice scrollable table: <div style="height: 300px;"> <lightning-datatable various-params></...
Tyler Dahle's user avatar
  • 2,699
8 votes
3 answers
10k views

Can we specify a minimum height for a lightning:datatable/lightning-datatable?

Problem lightning:datatable (rendered as a lightning-datatable) places itself in a wrapper that is only exactly as big as it needs to be. If you click on a header-level action in a table with no rows,...
sfdcfox's user avatar
  • 491k
8 votes
2 answers
12k views

How to present a lightning-datatable on mobile devices?

While a lightning-datatable will squish up on a narrow screen, the columns typically become so narrow as to be unreadable. Are there examples anywhere of changing to e.g. tiles for a narrow screen? ...
Keith C's user avatar
  • 136k
8 votes
3 answers
16k views

How to make buttons in a lightning-datatable smaller in LWC?

I have a lightning-datatable in my Lightning Web Component (LWC) that has several buttons in each row (first button only shown here): These standard-sized buttons consume quite a lot of vertical ...
Keith C's user avatar
  • 136k
7 votes
1 answer
4k views

How can I disable the checkboxes for specific rows on lightning:datatable?

I have a lightning:datatable component: <lightning:datatable columns="{!v.columnsPhone}" data="{!v.dataPhone}" keyField="id" ...
tutouser's user avatar
7 votes
4 answers
5k views

lightning:datatable component cutting off actions drop down menu when it goes past the card and displays scrollbar instead

I am having a problem using the lightning:datatable component that is contained in a lightning:card component. The actions on the table rows are getting cut off if it expands beyond the card instead ...
Jayesh Bhatnagar's user avatar
6 votes
2 answers
6k views

How to conditionally disable the LWC Standard Datatable buttons

I have two buttons called Add and Remove in my datatable columns, i have a checkbox field called isActive on my Account object. If isActive=true, on load of my component Add button should disable ...
Chowdary's user avatar
  • 119
6 votes
3 answers
7k views

Conditionally enable edit in lightning:datatable

I'm trying to do a dynamic editable field, this is what I've got: Component <lightning:datatable columns="{!v.columns}" data="{! v.data }" keyField="{! v.keyField }" ...
M. Massula's user avatar
5 votes
0 answers
2k views

LWC lightning datatable: Enabling Popover Overflow

I'm creating a lwc datatable with a custom column which contains a button and a corresponding popover. The problem is that the popover will not display as I would like it to, though by playing ...
thomnguyen's user avatar
5 votes
2 answers
6k views

DOM manipulation on lightning:datatable

I want to add attributes or classes for rows/cells in lightning:datatable based on cell values (I want to customize styles based on values). Is it possible? How can this be achieved? P.S. I tried to ...
user39399's user avatar
  • 1,034
4 votes
1 answer
143 views

Error and Changes in Spring 24 to define Column type - Picklist with LWC Datatable

I have been trying for much too long to get a create a custom data type of picklist for an LWC table. I have read the standard docs about creating an editable custom type, and reviewed the many ...
BritishBoyinDC's user avatar
4 votes
3 answers
23k views

Conditionally highlight a cell using datatable in LWC

How can we conditionally highlight/color a cell using datatable in LWC? If that's not possible , what are other options to highlight a cell conditionally in the table?
Manish Anand's user avatar
4 votes
1 answer
703 views

What is the third parameter "primer" in the lightning-datatable sort example?

The example "Datatable with Sortable Column" (from the lightning-datatable documentation) includes this code where a primer parameter is declared and used in the sortBy function: sortBy(...
Keith C's user avatar
  • 136k
4 votes
3 answers
12k views

Lightning datatable column value misaligned

I have a lightning datatable with column as type number The row value in it is getting right aligned, while everything else is left aligned, I need to make it uniform. Here is what I tried -- &...
mvk1991's user avatar
  • 545
3 votes
1 answer
2k views

LWC Datatable sort - how do I not use a url to sort name hyperlink column?

I have a datatable in my LWC with sorting that all works well, except when I want to sort on a link it is obviously using the fieldName "nameUrl" to sort with, rather than the label. My ...
Irene's user avatar
  • 1,829
3 votes
1 answer
8k views

Lightning DataTable onCellChange

I would like to know if there is any way I can do autosave when I change a cell value in the Lightning:datatable. I have gone through the doc https://developer.salesforce.com/docs/component-library/...
Noob_NoVoice's user avatar
  • 2,709
3 votes
2 answers
9k views

Freeze first column in horizontal scroll on lightning data table salesforce

I have created lightning datatable. How to freeze first column only while scrolling horizontal (not vertical) in lightning datatable.( or css) Source code : <div class="slds-scrollable_y" style="...
user avatar
3 votes
1 answer
15k views

How to make columns lwc lightning-datatable dynamic with button-icon

I have a lwc component with a lightning-datatable with the first column as a button-icon. This works when the columns are defined as a constant. Constant working const columns = [ { label: ...
Thomas's user avatar
  • 2,294
3 votes
3 answers
10k views

LWC - Lightning-Datatable Not Refreshing When Data Changes

I have a simple component that calls an apex method which returns some records. I want to display them. The problem is when I fetch the records and add them into the array, the component does not ...
M guy's user avatar
  • 763
2 votes
1 answer
7k views

How do I put slds-scrollable horizontal scroll at bottom of table (instead of bottom of page)?

I have a lightning:datatable component which has quite a lot of columns, where we want the user to scroll horizontally. The horizontal scrollbar is fixed to the bottom of the page. I would like to ...
Greg J's user avatar
  • 175
2 votes
1 answer
3k views

Nested / multi level lighting:datable

I'm looking to see (If it is even possible) to create a multi level lightning datatable. I.E. The parent object has a tickbox in table element 0, If selected a sublevel opens and you can see the ...
TimChadwick's user avatar
2 votes
1 answer
2k views

Spring 18 <lightning:datatable> Issue with Actions

I am facing an issue with the actions(Show Details, Delete). The Action dropdown is hidden inside the table instead of showing all actions. PFB screenshot. Did anyone face this issue? Below ...
singh_indupal's user avatar
2 votes
2 answers
5k views

LWC Datatable with custom data type not rendering as supose

I have formula fields that show HTML values and I need to show them in a custom related record data table What I have tried so far. https://salesforcecodex.com/2019/10/show-image-in-lightning-web-...
AjFmO's user avatar
  • 292
2 votes
2 answers
4k views

Time conversion LWC datatable - Apex

I have two Time field in my Custom Object Start Time and `End Time Start Time Value ==>8:30 AM End Time Value ==>6:00 PM From Apex Wrapper class I'm returning the time values. @AuraEnabled public ...
SFDC_Beginner's user avatar
2 votes
1 answer
5k views

Can we use Accordion Feature in Lightning-datatable LWC

Can we use accordion feature in Lightning-Datatable LWC ? or Any other way to achieve same functionality in Lightning-Datatable LWC? We have already built Lightining-datatable and using all its ...
Shailesh Mali's user avatar
2 votes
1 answer
14k views

How to filter Data in dataTable lwc based on the input in search bar?

I am trying to enhance my LWC Skill, so I am trying to mimic the file object in SF. So file object in SF classic we have search criteria which is not available in Lightning. Hence I am trying to add a ...
Abhishek Khosla's user avatar
2 votes
1 answer
2k views

LWC Datatable: How to apply CSS to the text content?

I have a datatable in LWC. For one of the columns, I am setting the style class to slds-icon-custom-custom9 which changes the text content of that column to white. When I hover the cursor over this ...
Manish Anand's user avatar
2 votes
1 answer
3k views

Not able to Sort Url Column in LWC Datatable

i am trying to build datatable where I want to show Product Name as url so that User can go that particular record JS where i am making my name field as URL { let nameUrl; this....
Abhishek Khosla's user avatar
2 votes
1 answer
5k views

Infinite scroll in lightning datatable in LWC increments offset multiple times

Infinite scroll in LWC datatable is calling the loadMoreData() function multiple times. This increments the offset multiple times but wire is not called multiple times and hence some data gets skipped ...
Koustubh's user avatar
  • 1,143