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
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
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
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
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
12 votes
3 answers
54k views

How to set lightning:datatable fixed column widths

I'm trying to set the column widths for lightning:datatable, but I don't see anywhere in the documentation on how to do this. I was thinking of tinkering with minColumnWidth and maxColumnWidth and ...
Brian Miller's user avatar
  • 5,212
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
10 votes
2 answers
6k views

Expand/collapse rows in a datatable

One of the requirements that we have is to make a datatable(or something that looks very similar) with expanding rows. An example would be: Year 199x, I have a video collection of VHS and I want ...
Novarg's user avatar
  • 5,264
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
9 votes
1 answer
3k views

How to handle percentage factor of 100 problems when using lightning:input and lightning:datatable?

When working on a bug, I just noticed that lighting:input now supports two percentage formatters, where the older one percent expects the user to know to enter e.g. 0.5 for 50%: <lightning:input ...
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
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
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
7 votes
1 answer
13k views

Lightning:datatable preselect rows

I have a lightning datatable that i would like to preselect all the rows when i load it. I'm currently doing like described in the lighting:datatable definition page but no luck so far Supposedely ...
R. Silva's user avatar
7 votes
1 answer
4k views

LWC: New line character not working after deployment

I have a Lightning Web Component on my contact detail page. It displays the address. I have used \n while displaying different fields of address. When I deployed the code to another sandbox, the \n ...
Koustubh's user avatar
  • 1,143
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
7 votes
1 answer
3k views

Applying css to lightning-datatable header columns [closed]

I have created a Lightning Web Component which has a lightning-datatable. I want to wrap the header row label. At present, it is like this I would like to display it like this I have tried different ...
user2790625's user avatar
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
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
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
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
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
1 answer
3k views

lightning:dataTable in a multi-currency org

Trying to figure out how to handle records with multiple currency. The dataTable definitions are for the column. I do not see anywhere in the documentation where the currency code of an individual row ...
Eric's user avatar
  • 54.2k
6 votes
2 answers
17k views

How do you center align the text of the column headings for a lightning:datatable?

I'm able to apply color or make the column heading text bold, but I can't center align the text for some reason. <lightning:datatable data="{! v.data }" columns="{! v.columns }" ...
Franz's user avatar
  • 115
6 votes
1 answer
5k views

Possible to change url target in lightning datatable?

I am using a <lightning:datatable> to display some data in a Quick Action. It works great, and I was able to get the table to display the name of a parent record as a link using a column ...
Adrian Larson's user avatar
  • 150k
6 votes
1 answer
1k views

Any way to introduce a separator into lightning:datatable row actions?

In SLDS there is a slds-has-divider_top-space style that allows a separator to be displayed between groups of actions: and this class can be specified in e.g. a lightning:menuItem. Is there any way ...
Keith C's user avatar
  • 136k
6 votes
1 answer
932 views

LWC - How to communicate property changes down the hierarchy

By following a tutorial (How to use custom LWC lightning component in lightning-datatable) I was able to extend lightning datatable and insert a button into the final column. Now, I am currently ...
DylanR's user avatar
  • 107
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
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
5 votes
1 answer
8k views

Distinguish between two row actions of datatable for LWC

I have two buttons on each row of my datatable. Note that I am using LWC. Problem is, both the buttons use the same onrowaction method in Javascript. Hence both buttons run the same code and work the ...
Koustubh's user avatar
  • 1,143
5 votes
1 answer
2k views

Static values for `<lightning:datatable>`

I've got a working datatable using the following in my component markup: <lightning:datatable columns="{!v.columns}" data="{!v.configuration.channels}" keyField="channelId"/> Columns is a List ...
Matt Lacey's user avatar
  • 25.6k
5 votes
1 answer
3k views

Lighting datatable doesn't apply styling to 1st row in LWC

I have a lightning datatable in my LWC. I have applied column border styling to it, but it's not getting applied only to the 1st row. Rest all rows get the styling. I didn't find any explanation for ...
Koustubh's user avatar
  • 1,143
5 votes
1 answer
7k views

Lightning Datatable Picklist and Lookup Work Around [duplicate]

I am aware that lightning:datatable does not support picklists. The approved attributes are: action boolean button button-icon currency date date-local email location number percent phone ...
Olivia's user avatar
  • 3,461
5 votes
1 answer
3k views

lightning-datatable row number error

I have a lightning web component, using lighting-datatable with row-numbers visible. This works well up to 99 records... then I get this: [![enter image description here][1]][1] My component code: ...
PatMcClellan__c's user avatar
5 votes
1 answer
5k views

Dynamic Button Icons in a Data Table Similar to Dynamic Actions in a Data Table

It's possible to have actions for each row in a data table that change depending on the contents of the rows (that are changed by those very actions). For example: The component reference provides ...
Gabriel Rivera'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
0 answers
677 views

Confirmation that it is presently not possible to create a custom icon and use it in a lightning:datatable?

The lightning:datatable has an "Appending an Icon to Column Data" feature that allows an iconName to be taken from one of the data fields and the icon output to the left or right of the cell text. The ...
Keith C's user avatar
  • 136k
5 votes
1 answer
3k views

LWC Datatable - Turn Custom Lookup Field Value in Editable Datatable to Draft Value for Mass Update

As you know, datatables do not support lookup field. I've built a search lookup field that queries an object, and added that to the LWC datatable as a custom type. The id of the selected record (...
Fred's user avatar
  • 51
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
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
4 votes
1 answer
4k views

Richtext type attribute in Datatable

I have a column which displays rich text in a lightning data table, how do I escape the special characters?Is there any type attribute?
cartman's user avatar
  • 1,596
4 votes
1 answer
7k views

Can we make lightning datatable header static in LWC?

Lightning datatable header scrolls along with values in my LWC. How can I make the headers fixed? I tried pasting the datatable code from here and adding CSS position:fixed attribute, but it did not ...
Koustubh's user avatar
  • 1,143
4 votes
1 answer
3k views

When using @wire I can't get lightning-datatable to show the field value

I am using @wire and getListUi to get a list view of accounts. I have a lightning-datatable where, for now, I just want to display the name of each account. Relevant part of the template: <...
Luke Bray's user avatar
  • 506
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
1 answer
5k views

Can we detect when an LWC lightning-datatable ENTERS inline edit mode?

I have a lightning-datatable component within a custom lwc component (lets call it child), and that component sits within another component we'll call parent. There is a Next button in the parent ...
ministe's user avatar
  • 324
4 votes
1 answer
3k views

How to use a smaller font in lightning-datatable?

We are in the process of moving from Classic to Lightning. I am rebuilding some Visualforce pages to Lightning Web Components. One of the many challenges is this one: The font that is used in a ...
Sander de Jong's user avatar
4 votes
2 answers
2k views

Can lightning:datatable be configured or coded so a click anywhere in a row selects the row?

A click on a table cell in a basic lightning:datatable highlights the cell border but does not select the row. For the common case where the table is just listing read-only data, being able to click/...
Keith C's user avatar
  • 136k
4 votes
1 answer
2k views

How do I switch off the 'edited' highlighting in LWC lighting-datatable?

I'm using a lightning-datatable in LWC, and hooking into 'oncellchange' to ensure that any inline editing is automatically included in the underlying javascript data model immediately. I then have ...
Rob Baillie's user avatar

1
2 3 4 5
15