14 votes

LWC - Extended lightning datatable with picklist is not working

Try applying wrapText: true to your required column detail. The picklist values are getting clipped automatically, Setting wrapText will allow opening the picklist popup. const exampleColumns = [ {...
Akshay Poddar's user avatar
10 votes

Passing parameter in getRowActions

To make sure you have access to class variables, bind this to the function: { type: 'action', typeAttributes: { rowActions: this.getRowActions.bind(this) } },
sfdcfox's user avatar
  • 487k
9 votes
Accepted

Add bold style to last row in Lightning Data table

For now, you can modify styles inside standard components by specifying your own custom CSS. I don't know if they'll continue to allow this in the future, however. The documentation is apparently ...
sfdcfox's user avatar
  • 487k
8 votes
Accepted

Query for Emails sent in the past month, unsubscribes opens, clicks for each

Sent, Unsubscribes, Opens, and Clicks in Past Month I. Data Views SFMC Dataviews required for this query include: _Job _Sent _Unsubscribe _Open _Click II. Methodology Querying this many dataviews ...
jacobhobson's user avatar
8 votes

Insert a link in lightning datatable Column Value

Your Type Attributes, and likely the underlying data, aren't set up properly for a url type entry. Your url item should correspond to the column in your data that contains a URL value (not the link'...
David Reed's user avatar
  • 92.6k
7 votes

How to display a checkbox field using ligntning:datatable?

Checkbox columns are now supported out-of-the-box in lightning:datatable and doesn't require custom Javascripting. boolean: Displays the icon utility:check if the value is true, and a blank ...
Mahmood's user avatar
  • 5,969
7 votes
Accepted

Date formatting to MM/DD/YYYY in LWC datatable

lightning-datatable internally uses lightning-formatted-date to output date field. To output, the date in MM/DD/YYYY format set the type attribute to typeAttributes: { day: "numeric", month:...
Anmol Kumar's user avatar
  • 3,599
6 votes
Accepted

Is it possible to call a Lightning Component from a Javascript function?

There is an event named force:navigateToComponent. You can use this event for going to another component. It is currently in the Beta version in the Winter '17 release. Example: var evt = $A.get("e....
Junaid P Khader's user avatar
6 votes

How to display a checkbox field using ligntning:datatable?

You can use the iconName cell attribute to display icons in your datatable (see the "Appending an Icon to Column Data" section in the documentation). This can either be a static value, e.g. utility:...
Pawel Fronczak's user avatar
6 votes

Data table - Apex refresh is not working in lwc

This is a simple mistake of not using the entire response object, but instead trying to use just one of its properties. Instead of: @wire(getParentGuardian, { EnrollmentId: "E0008" }) enroll({ data, ...
Phil W's user avatar
  • 35.6k
6 votes

How to clear draft values in LWC datatable after save

I have had success with clearing the draft values on the lightning-datatable by directly editing the draftValues property on the lightning-datatable DOM element. This seems to remove the Save and ...
Matthew Souther's user avatar
5 votes
Accepted

Lightning Datatable - Errors Attribute

When you define a datatable you asign an error attribute to it. Now whenever you feel that you should display error for a particular cell after a validation session, you just input values to the ...
Pranay Jaiswal's user avatar
5 votes

Lightning Datatable Picklist and Lookup Work Around

In Aura lightning:datatable, it is not possible to have custom components but in LWC lightning-datatable, it is possible to have custom component in table columns. Below are the steps: Create your ...
salesforce-sas's user avatar
5 votes
Accepted

LWC is it Possible to Load the JQuery Plugin Datatables in a Lightning Web Component?

SOLVED! Here's how I did it: MyLwc.html <table lwc:dom="manual" class="example-table display" style="width:100%"></table> Query for the table using this.template.querySelector(); ...
Isaac L's user avatar
  • 174
5 votes
Accepted

How to fix a left column of a manual table in LWC

Try this one css selector : table tr>th:first-child /* or .slds-table tr>th:first-child */ { position: sticky; z-index: 1; top: 0; left: 0; } Element selector goes without prepending . ...
Oleh Berehovskyi's user avatar
5 votes
Accepted

Hide button inside Lightning Datatable based on row value

You shouldn't be putting a plain button in a list for that purpose. Use an action menu, and specify the actions dynamically using getRowActions, as demonstrated in the docs. this.columns = [ ...
sfdcfox's user avatar
  • 487k
5 votes

Datatable LWC tbody in another component

This is happening because you have another element in the structure, the child component, with its shadow DOM. The output (ignoring shadow DOM boundaries) is structured something like this: <c-...
Phil W's user avatar
  • 35.6k
4 votes

Sorting function not working

SLDS only give you sort icon. They don't actually sort data for you. So you need to write your custom logic to sort the table. You can use Order By clause of SOQL to sort the records.
Tushar Sharma's user avatar
4 votes

Why Lightning:datatable typeAttributes do not support neither tooltip nor title for url?

Tooltip customization is available in Winter '19 release. As per the documents: This attribute for the URL type column property is new. tooltip — Displays a tooltip for a URL in the datatable column. ...
Say1218's user avatar
  • 41
4 votes
Accepted

apex:actionsupport event not firing

You have to nest the <apex:actionSupport> tag within the tag whose action you are trying to support. You have it inverted. Correct <a ...> <apex:actionSupport ... /> </a> ...
Adrian Larson's user avatar
  • 150k
4 votes
Accepted

How to rename 'Checkbox' column in lightning 'datatable' component?

You can't modify the behavior of the select row column. Recommended Action Specify an action button in the upper-right area (where "Close" is in your images) with a button to link/unlink, and use ...
sfdcfox's user avatar
  • 487k
4 votes
Accepted

Lightning Web Components inline editing Datatable - data update issue

Before I begin with my answer, I would like to point a few key points. 1) There is no two-way binding, LWC works in prop-down - event up. That means when you edit anything on the UI, you have to ...
Pranay Jaiswal's user avatar
4 votes

Passing parameter in getRowActions

Adding more details in addition @sfdcfox answer You are facing that problem because of lexical scoping. You can use binding (as suggested by @sfdcfox) RowActions: this.getRowActions.bind(this) } OR ...
salesforce-sas's user avatar
4 votes
Accepted

How to handle events from LWC datatable custom data types

Finally got through it. I had to dispatch event with composed and bubbles attributes as follows. const event = CustomEvent('refresh', { composed: true, bubbles: true }); this.dispatchEvent(...
Isuru Buddhika Herath's user avatar
4 votes
Accepted

How to dynamicall assign errors to lightning:datatable errors attribute

You're supposed to make an actual object. let errors = {}; errors.rows = {}; errors.rows[rowId] = { title: 'We found an error', messages: [ 'Enter a valid amount.' ], fields: [ 'amount' }; // ... etc ...
sfdcfox's user avatar
  • 487k
4 votes

LWC Datatable - Get the Row Number when editing a column

You don't get the row number, but you do get the key-field value. This is sufficient to find the matching row. var rowIndex = this.data.findIndex(row => row.id === event.detail.draftValues[0].id); ...
sfdcfox's user avatar
  • 487k
4 votes

Inline Editing field needs to be required field in Lightning Data table - LWC?

There are a few scenarios you should consider when requiring / validating entry in a lightning-datatable. A custom "required input cell" with an asterisk on edit would only be possible if ...
gale-force-wizard's user avatar
4 votes
Accepted

LWC lightning-datatable not accepting cellAttributes in the first column

The first column of lightning-datatable is a th element, while all remaining columns are a td element. This is a problem for your class, because of this slds rule: .slds-table th { font-weight: ...
sfdcfox's user avatar
  • 487k
3 votes
Accepted

Requested unknown parameter '1' for row 0

This is possibly the most cryptic warning message that DataTables will show. It is a short error message as it needs to cope with all of the data source options that DataTables has, but flexible ...
Eric's user avatar
  • 54.1k
3 votes

Jquery conflict in VF Page

You can isolate your DataTables JavaScript code to its specific version of jQuery by using this pattern: <script src="... path to jquery-1.11.1 ..."></script> <script> (function(j$) ...
Keith C's user avatar
  • 136k

Only top scored, non community-wiki answers of a minimum length are eligible